* [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling @ 2022-01-22 12:59 Harry Austen 2022-01-23 8:52 ` Chao Yu 2022-01-24 19:25 ` Eric Biggers 0 siblings, 2 replies; 5+ messages in thread From: Harry Austen @ 2022-01-22 12:59 UTC (permalink / raw) To: linux-f2fs-devel; +Cc: jaegeuk, linux-kernel, Harry Austen FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it and returning success. Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) Signed-off-by: Harry Austen <harryausten@hotmail.co.uk> --- fs/f2fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 92ec2699bc85..061bf35c2582 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3085,9 +3085,8 @@ int f2fs_fileattr_set(struct user_namespace *mnt_userns, return -EIO; if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode))) return -ENOSPC; - if (fsflags & ~F2FS_GETTABLE_FS_FL) + if (fsflags & ~F2FS_SETTABLE_FS_FL) return -EOPNOTSUPP; - fsflags &= F2FS_SETTABLE_FS_FL; if (!fa->flags_valid) mask &= FS_COMMON_FL; -- 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling 2022-01-22 12:59 [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling Harry Austen @ 2022-01-23 8:52 ` Chao Yu 2022-01-24 19:25 ` Eric Biggers 1 sibling, 0 replies; 5+ messages in thread From: Chao Yu @ 2022-01-23 8:52 UTC (permalink / raw) To: Harry Austen, linux-f2fs-devel; +Cc: jaegeuk, linux-kernel On 2022/1/22 20:59, Harry Austen wrote: > FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute > (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it > and returning success. > > Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) > Signed-off-by: Harry Austen <harryausten@hotmail.co.uk> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling 2022-01-22 12:59 [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling Harry Austen 2022-01-23 8:52 ` Chao Yu @ 2022-01-24 19:25 ` Eric Biggers 2022-01-25 22:01 ` Harry Austen 1 sibling, 1 reply; 5+ messages in thread From: Eric Biggers @ 2022-01-24 19:25 UTC (permalink / raw) To: Harry Austen; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel On Sat, Jan 22, 2022 at 12:59:03PM +0000, Harry Austen wrote: > FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute > (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it > and returning success. > > Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) > Signed-off-by: Harry Austen <harryausten@hotmail.co.uk> > --- > fs/f2fs/file.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 92ec2699bc85..061bf35c2582 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -3085,9 +3085,8 @@ int f2fs_fileattr_set(struct user_namespace *mnt_userns, > return -EIO; > if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode))) > return -ENOSPC; > - if (fsflags & ~F2FS_GETTABLE_FS_FL) > + if (fsflags & ~F2FS_SETTABLE_FS_FL) > return -EOPNOTSUPP; > - fsflags &= F2FS_SETTABLE_FS_FL; > if (!fa->flags_valid) > mask &= FS_COMMON_FL; This is intentional, and matches what ext4 does; see the comment in the ext4 implementation of this: /* * chattr(1) grabs flags via GETFLAGS, modifies the result and * passes that to SETFLAGS. So we cannot easily make SETFLAGS * more restrictive than just silently masking off visible but * not settable flags as we always did. */ Also, even if this patch was correct, the Fixes tag is wrong. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling 2022-01-24 19:25 ` Eric Biggers @ 2022-01-25 22:01 ` Harry Austen 2022-01-25 22:13 ` Eric Biggers 0 siblings, 1 reply; 5+ messages in thread From: Harry Austen @ 2022-01-25 22:01 UTC (permalink / raw) To: Harry Austen, Eric Biggers; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel On Monday, 24 January 2022 19:25:44 GMT Eric Biggers wrote: > On Sat, Jan 22, 2022 at 12:59:03PM +0000, Harry Austen wrote: > > FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute > > (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it > > and returning success. > > > > Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) > > Signed-off-by: Harry Austen <harryausten@hotmail.co.uk> > > --- > > > > fs/f2fs/file.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index 92ec2699bc85..061bf35c2582 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -3085,9 +3085,8 @@ int f2fs_fileattr_set(struct user_namespace > > *mnt_userns,> > > return -EIO; > > > > if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode))) > > > > return -ENOSPC; > > > > - if (fsflags & ~F2FS_GETTABLE_FS_FL) > > + if (fsflags & ~F2FS_SETTABLE_FS_FL) > > > > return -EOPNOTSUPP; > > > > - fsflags &= F2FS_SETTABLE_FS_FL; > > > > if (!fa->flags_valid) > > > > mask &= FS_COMMON_FL; > > This is intentional, and matches what ext4 does; see the comment in the ext4 > implementation of this: > > /* > * chattr(1) grabs flags via GETFLAGS, modifies the result and > * passes that to SETFLAGS. So we cannot easily make SETFLAGS > * more restrictive than just silently masking off visible but > * not settable flags as we always did. > */ Ah, my apologies. I thought it looked a little too obvious. Clearly I should have looked at the ext4 code. Please disregard this patch. Is there anything else that could be done to improve unsettable attribute handling? For example, is there a reason FS_NOCOW_FL is gettable but not settable? Could it be added to the settable list? > > Also, even if this patch was correct, the Fixes tag is wrong. Having looked at this a bit more, I assume you are saying this due to the missing double quotes around the commit summary? (just so I know for next time as this is my first attempt at sending a kernel patch) > > - Eric Many thanks for your help Eric, Harry _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling 2022-01-25 22:01 ` Harry Austen @ 2022-01-25 22:13 ` Eric Biggers 0 siblings, 0 replies; 5+ messages in thread From: Eric Biggers @ 2022-01-25 22:13 UTC (permalink / raw) To: Harry Austen; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel On Tue, Jan 25, 2022 at 10:01:49PM +0000, Harry Austen wrote: > On Monday, 24 January 2022 19:25:44 GMT Eric Biggers wrote: > > On Sat, Jan 22, 2022 at 12:59:03PM +0000, Harry Austen wrote: > > > FS_IOC_SETFLAGS ioctl should return EOPNOTSUPP if the file attribute > > > (e.g. FS_NOCOW_FL) is not supported, rather than silently ignoring it > > > and returning success. > > > > > > Fixes: 9b1bb01c8ae7 (f2fs: convert to fileattr) > > > Signed-off-by: Harry Austen <harryausten@hotmail.co.uk> > > > --- > > > > > > fs/f2fs/file.c | 3 +-- > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > > index 92ec2699bc85..061bf35c2582 100644 > > > --- a/fs/f2fs/file.c > > > +++ b/fs/f2fs/file.c > > > @@ -3085,9 +3085,8 @@ int f2fs_fileattr_set(struct user_namespace > > > *mnt_userns,> > > > return -EIO; > > > > > > if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode))) > > > > > > return -ENOSPC; > > > > > > - if (fsflags & ~F2FS_GETTABLE_FS_FL) > > > + if (fsflags & ~F2FS_SETTABLE_FS_FL) > > > > > > return -EOPNOTSUPP; > > > > > > - fsflags &= F2FS_SETTABLE_FS_FL; > > > > > > if (!fa->flags_valid) > > > > > > mask &= FS_COMMON_FL; > > > > This is intentional, and matches what ext4 does; see the comment in the ext4 > > implementation of this: > > > > /* > > * chattr(1) grabs flags via GETFLAGS, modifies the result and > > * passes that to SETFLAGS. So we cannot easily make SETFLAGS > > * more restrictive than just silently masking off visible but > > * not settable flags as we always did. > > */ > > Ah, my apologies. I thought it looked a little too obvious. Clearly I > should have looked at the ext4 code. Please disregard this patch. > > Is there anything else that could be done to improve unsettable > attribute handling? For example, is there a reason FS_NOCOW_FL is > gettable but not settable? Could it be added to the settable list? A lot of flags are gettable by FS_IOC_GETFLAGS but not settable by FS_IOC_SETFLAGS, typically because they can only be set through a dedicated interface. For example, the encrypt flag can only be set using FS_IOC_SET_ENCRYPTION_POLICY, or via inheritance. > > > > Also, even if this patch was correct, the Fixes tag is wrong. > > Having looked at this a bit more, I assume you are saying this due to > the missing double quotes around the commit summary? (just so I know for > next time as this is my first attempt at sending a kernel patch) > There's that, but more importantly the commit you listed is wrong. The relevant code was added by an earlier commit, and that commit just moved it. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-25 22:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-22 12:59 [f2fs-dev] [PATCH] f2fs: fix fileattr_set unsupported attribute handling Harry Austen 2022-01-23 8:52 ` Chao Yu 2022-01-24 19:25 ` Eric Biggers 2022-01-25 22:01 ` Harry Austen 2022-01-25 22:13 ` Eric Biggers
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).