write retry on filesystem

Siddharth Aggarwal saggarwa at cs.utah.edu
Wed Jan 5 23:33:16 GMT 2005


Hi,

I have a pseudo disk driver that does a copy on write to a log device.

I want to disable further retries to write if the disk space on the log
device is full. I have inserted the following code into the strategy routine

For this I have set the error code and also set the resid to zero,
thinking that the filesystem above will not retry the operation because it
assumes that there are no more bytes to be written (since I set resid to
0). However, control keeps coming back to this code, suggesting that the
FS (buffer cache) is constantly retrying the operation. Is there any other
way to do this (maybe I should try a different error code. I tried ENOSPC
too).

The reason I want to disable retry is to allow the user to manually
select and delete logs to reclaim space and then do the file operation
again if he chooses to. The problem arising is because the buffer cache is
asynchronously flushed to disk (which could be much after a vfs file write
operation). So the application has no way of knowing that a write to disk
failed because COW failed due to log device space shortage. So the syncer
periodically keeps trying to flush the buffer cache to disk because every
time the strategy routine (in my driver which is between the buffer cache
and the disk) cannot complete the operation.

Any suggestions on how I can accomplish this? Any suggested hack in
vfs_bio?

Thanks,
Sid.


strategy ()
{
   .....
    if (failed < 0) /* no more free space on log device */
            {
                printf ("No more space on disk! Copy on write failed\n");
                bp->b_error = EACCES;
                bp->b_flags |= B_ERROR;
                bp->b_resid = 0;
                devstat_end_transaction_buf(&ss->device_stats, bp);
                biodone(bp);
                return;
            }
   ....
}




More information about the freebsd-fs mailing list