Skip to content

Commit e23ab80

Browse files
author
Jaegeuk Kim
committed
f2fs: check the generic conditions first
Let's return errors caught by the generic checks. This fixes generic/494 where it expects to see EBUSY by setattr_prepare instead of EINVAL by f2fs for active swapfile. Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent d738f70 commit e23ab80

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

fs/f2fs/file.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,18 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
10481048
if (unlikely(f2fs_cp_error(sbi)))
10491049
return -EIO;
10501050

1051+
err = setattr_prepare(idmap, dentry, attr);
1052+
if (err)
1053+
return err;
1054+
1055+
err = fscrypt_prepare_setattr(dentry, attr);
1056+
if (err)
1057+
return err;
1058+
1059+
err = fsverity_prepare_setattr(dentry, attr);
1060+
if (err)
1061+
return err;
1062+
10511063
if (unlikely(IS_IMMUTABLE(inode)))
10521064
return -EPERM;
10531065

@@ -1077,18 +1089,6 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
10771089
return -EINVAL;
10781090
}
10791091

1080-
err = setattr_prepare(idmap, dentry, attr);
1081-
if (err)
1082-
return err;
1083-
1084-
err = fscrypt_prepare_setattr(dentry, attr);
1085-
if (err)
1086-
return err;
1087-
1088-
err = fsverity_prepare_setattr(dentry, attr);
1089-
if (err)
1090-
return err;
1091-
10921092
if (is_quota_modification(idmap, inode, attr)) {
10931093
err = f2fs_dquot_initialize(inode);
10941094
if (err)

0 commit comments

Comments
 (0)