summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-04-23 12:28:18 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-05-07 10:21:56 +0900
commit916decbf3913ccdc68f0228e001a6d270cf5682e (patch)
treeeb95e80e4a681752b655d236a661f8179fb1c427 /fs/f2fs
parentc02745ef684f9a6f98f30388ed048ee460db5483 (diff)
f2fs: return errors right after checking them
This patch adds two error conditions early in the setxattr operations. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/xattr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index bbe9c2badf5d..6073f9f88416 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -509,8 +509,16 @@ static int __f2fs_setxattr(struct inode *inode, int index,
here = __find_xattr(base_addr, index, len, name);
found = IS_XATTR_LAST_ENTRY(here) ? 0 : 1;
- last = here;
+ if ((flags & XATTR_REPLACE) && !found) {
+ error = -ENODATA;
+ goto exit;
+ } else if ((flags & XATTR_CREATE) && found) {
+ error = -EEXIST;
+ goto exit;
+ }
+
+ last = here;
while (!IS_XATTR_LAST_ENTRY(last))
last = XATTR_NEXT_ENTRY(last);