diff options
-rw-r--r-- | fs/f2fs/xattr.c | 10 |
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, | |||
509 | here = __find_xattr(base_addr, index, len, name); | 509 | here = __find_xattr(base_addr, index, len, name); |
510 | 510 | ||
511 | found = IS_XATTR_LAST_ENTRY(here) ? 0 : 1; | 511 | found = IS_XATTR_LAST_ENTRY(here) ? 0 : 1; |
512 | last = here; | ||
513 | 512 | ||
513 | if ((flags & XATTR_REPLACE) && !found) { | ||
514 | error = -ENODATA; | ||
515 | goto exit; | ||
516 | } else if ((flags & XATTR_CREATE) && found) { | ||
517 | error = -EEXIST; | ||
518 | goto exit; | ||
519 | } | ||
520 | |||
521 | last = here; | ||
514 | while (!IS_XATTR_LAST_ENTRY(last)) | 522 | while (!IS_XATTR_LAST_ENTRY(last)) |
515 | last = XATTR_NEXT_ENTRY(last); | 523 | last = XATTR_NEXT_ENTRY(last); |
516 | 524 | ||