f2fs: don't allow volatile writes for non-regular file
PATCH 1/1 f2fs: don't allow volatile writes for non-regular file
Now f2fs only supports volatile writes for journal db regular file.
--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
@@ -1593,6 +1593,9 @@ static int f2fs_ioc_start_volatile_write(struct file *filp)if (!inode_owner_or_capable (inode))return -EACCES ; +if (!S_ISREG (inode)) +return -EINVAL ; + ret =mnt_want_write_file (filp);if (ret)return ret;
Signature · 6 lines
2.8.2.295.g3f1c1d0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
kbuild test robot
build botreproduce:
Hi Chao,
[auto build test WARNING on f2fs/dev]
[also build test WARNING on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Chao-Yu/f2fs-don-t-allow-volatile-writes-for-non-regular-file/20170319-221605 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute
>> fs/f2fs/file.c:1598:14: sparse: incompatible types for operation (&)
fs/f2fs/file.c:1598:14: left side has type struct inode *inode
fs/f2fs/file.c:1598:14: right side has type int
fs/f2fs/file.c:1598:14: sparse: incompatible types for operation (==)
fs/f2fs/file.c:1598:14: left side has type bad type
fs/f2fs/file.c:1598:14: right side has type int
In file included from include/linux/stat.h:6:0,
from include/linux/fs.h:9,
from fs/f2fs/file.c:11:
fs/f2fs/file.c: In function 'f2fs_ioc_start_volatile_write':
include/uapi/linux/stat.h:20:26: error: invalid operands to binary & (have 'struct inode *' and 'int')
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
^
fs/f2fs/file.c:1598:7: note: in expansion of macro 'S_ISREG'
if (!S_ISREG(inode))
^~~~~~~vim +1598 fs/f2fs/file.c
1582 ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
1583 }
1584 err_out:
1585 inode_unlock(inode);
1586 mnt_drop_write_file(filp);
1587 return ret;
1588 }
1589
1590 static int f2fs_ioc_start_volatile_write(struct file *filp)
1591 {
1592 struct inode *inode = file_inode(filp);
1593 int ret;
1594
1595 if (!inode_owner_or_capable(inode))
1596 return -EACCES;
1597
> 1598 if (!S_ISREG(inode))
1599 return -EINVAL;
1600
1601 ret = mnt_want_write_file(filp);
1602 if (ret)
1603 return ret;
1604
1605 inode_lock(inode);
1606
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hello,
Sorry for my mistaken, have fixed and resent the patch.
[PATCH RESEND] f2fs: don't allow volatile writes for non-regular file
Thanks,
Quoted 62 lines · kbuild test robot
Hi Chao,
[auto build test WARNING on f2fs/dev]
[also build test WARNING on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Chao-Yu/f2fs-don-t-allow-volatile-writes-for-non-regular-file/20170319-221605 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attributeQuoted 1 line
Quoted 1 line
fs/f2fs/file.c:1598:14: sparse: incompatible types for operation (&)
fs/f2fs/file.c:1598:14: left side has type struct inode *inode
fs/f2fs/file.c:1598:14: right side has type int
fs/f2fs/file.c:1598:14: sparse: incompatible types for operation (==)
fs/f2fs/file.c:1598:14: left side has type bad type
fs/f2fs/file.c:1598:14: right side has type int
In file included frominclude/linux/stat.h:6:0,from include/linux/fs.h:9, from fs/f2fs/file.c:11: fs/f2fs/file.c: In function 'f2fs_ioc_start_volatile_write': include/uapi/linux/stat.h:20:26: error: invalid operands to binary & (have 'struct inode *' and 'int') #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) ^ fs/f2fs/file.c:1598:7: note: in expansion of macro 'S_ISREG' if (!S_ISREG(inode)) ^~~~~~~vim +1598
fs/f2fs/file.c1582 ret =
f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
1583 }
1584err_out:
1585inode_unlock(inode);
1586mnt_drop_write_file(filp);
1587 return ret;
1588 }
1589
1590 static intf2fs_ioc_start_volatile_write(struct file *filp)
1591 {
1592 struct inode *inode =file_inode(filp);
1593 int ret;
1594
1595 if (!inode_owner_or_capable(inode))
1596 return-EACCES;
1597Quoted 1 line
1598 if (!S_ISREG(inode))
1599 return
-EINVAL;
1600
1601 ret =mnt_want_write_file(filp);
1602 if (ret)
1603 return ret;
1604
1605inode_lock(inode);
1606
Quoted 6 lines
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot