f2fs: fix calculating incorrect free size when update xattr in __f2fs_setxattr
authorChao Yu <chao2.yu@samsung.com>
Tue, 29 Oct 2013 06:17:05 +0000 (14:17 +0800)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Tue, 29 Oct 2013 06:56:08 +0000 (15:56 +0900)
During xattr updating, free size should be corrected to remainder free size
+ old entry size.
It can avoid ENOSPC error when we update old entry with the same size new
entry at fully filled xattr.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/xattr.c

index 89d506d0b35d95059434315872a8fc58600e4789..aa7a3f139fe5336130d10dcfbe9813fa7ca95698 100644 (file)
@@ -520,7 +520,7 @@ static int __f2fs_setxattr(struct inode *inode, int name_index,
                 */
                free = MIN_OFFSET(inode) - ((char *)last - (char *)base_addr);
                if (found)
-                       free = free - ENTRY_SIZE(here);
+                       free = free + ENTRY_SIZE(here);
 
                if (free < newsize) {
                        error = -ENOSPC;