[Yaffs] write operation returns incorrect value in case device is out of space

Todd Poynor tpoynor at mvista.com
Wed Jan 25 01:27:14 GMT 2006


On Thu, Dec 22, 2005 at 06:10:26PM -0800, Mikhail Ryleev wrote:
...
> 
> --- 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)

Committed a modified version of above, thanks...

Index: yaffs_fs.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_fs.c,v
retrieving revision 1.39
diff -u -r1.39 yaffs_fs.c
--- yaffs_fs.c	24 Jan 2006 22:22:52 -0000	1.39
+++ yaffs_fs.c	25 Jan 2006 01:18:08 -0000
@@ -628,9 +628,9 @@
 
 	T(YAFFS_TRACE_OS,
 	  (KERN_DEBUG "yaffs_commit_write returning %d\n",
-	   nWritten == nBytes ? 0 : -1));
+	   nWritten == nBytes ? 0 : nWritten));
 
-	return nWritten == nBytes ? 0 : -1;
+	return nWritten == nBytes ? 0 : nWritten;
 
 }
 
@@ -788,8 +788,7 @@
 
 	}
 	yaffs_GrossUnlock(dev);
-
-	return nWritten != n ? -ENOSPC : nWritten;
+	return nWritten == 0 ? -ENOSPC : nWritten;
 }
 
 static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)



More information about the yaffs mailing list