|
write operation returns incorrect value in case device is out of space: msg#00078linux.file-systems.yaffs
There are at least two separate cases here:
1. device is out of space while writing an existing file.
This problem here is actually became worse with revision 1.32 of yaffs_fs.c that changed yaffs_commit_write routine to returns -1 (which is translated into EACESS errno) and at least is misleading. The attached patch fixes this problem while keeping desired effect of change 1.32.
It also fixes a problem with partially written data that actually should return the amount of data written.
2. device is out of space while creating new object. In this case current code returns ENOMEM error code which is also misleading. Unfortunatly, I do not see a simple fix here, the structure of code is such that it is hard to diffirenciate out-of-memory vs. out-of-space situation here but I think ENOSPC would be better here because it is more likely to happen.
M.
--- yaffs_fs.c 2005-12-16 18:23:10.000000000 -0800
_______________________________________________+++ ./new/yaffs_fs.c 2005-12-21 16:53:31.000000000 -0800 @@ -624,10 +624,9 @@ T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_commit_write returning %d\n", - nWritten == nBytes ? 0 : -1)); - - return nWritten == nBytes ? 0 : -1; + nWritten == nBytes ? 0 : nWritten)); + return nWritten == nBytes ? 0 : nWritten; } static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj) @@ -785,7 +784,7 @@ } yaffs_GrossUnlock(dev); - return nWritten != n ? -ENOSPC : nWritten; + return ( nWritten == n || nWritten > 0 ) ? nWritten : -ENOSPC; } static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) yaffs mailing list yaffs@xxxxxxxxxxxxxxxxxxxxxx http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Test suite: 00078, John M Cavallo |
|---|---|
| Next by Date: | Re: write operation returns incorrect value in case device is out of space: 00078, Todd Poynor |
| Previous by Thread: | Test suitei: 00078, Michael Trimarchi |
| Next by Thread: | Re: write operation returns incorrect value in case device is out of space: 00078, Todd Poynor |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |