smb: client: fix chmod(2) regression with ATTR_READONLY
Subsystems (2)
Hi,
thanks, Steve and Paulo! Considering the severity (chmod does not take effect anymore) and the fact that this regression was caused by dropping a condition in two lines of code that is merely being restored by the fix (basically, it's a partial revert), is there any way to prioritize this change as there's no production-ready workaround? It's difficult to avoid updating to 6.6+ at this point.
Cheers,
Horst Reiterer
-----Ursprüngliche Nachricht-----
Von: Steve French <[email protected]>
Gesendet: Montag, 17. Februar 2025 00:20
An: Paulo Alcantara <[email protected]>
Cc: [email protected]; Reiterer, Horst <[email protected]>
Betreff: Re: [PATCH] smb: client: fix chmod(2) regression with ATTR_READONLY
tentatively merged into cifs-2.6.git for-next pending more testing and review
Quoted 52 lines · Paulo Alcantara
When the user sets a file or directory as read-only (e.g. ~S_IWUGO), the client will set the
ATTR_READONLYattribute by sending anSMB2_SET_INFOrequest to the server in cifs_setattr_{,nounix}(), butcifsInodeInfo::cifsAttrswill be left unchanged as the client will only update the new file attributes in the next call to {smb311_posix,cifs}_get_inode_info() with the new metadata filled in @data parameter.Commit
a18280e7fdea("smb: cilent: set reparse mount points as automounts") mistakenly removed the @data NULL check when callingis_inode_cache_good(), which broke the above case as the newATTR_READONLYattribute would end up not being updated on files with a read lease.Fix this by updating the inode whenever we have cached metadata in @data parameter.
Reported-by Horst Reiterer <[email protected]>Closes:
https://lore.kernel.org/r/[email protected]
mFixes a18280e7fdea ("smb: cilent: set reparse mount points asautomounts")
Signed-off-by Paulo Alcantara (Red Hat) <[email protected]>--- fs/smb/client/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/smb/client/inode.c index renamed from fs/smb/client/inode.c +0
-0214240612549..616149c7f0a5 100644
fs/smb/client/inode.c +2
-3@@ -1421,7 +1421,7 @@ int cifs_get_inode_info(struct inode **inode,struct cifs_fattr fattr = {};int rc; -if (is_inode_cache_good (*inode)) { +if (!data &&is_inode_cache_good (*inode)) {cifs_dbg (FYI ,"No need to revalidate cached inode sizes\n" );return 0 ; }@@ -1520,7 +1520,7 @@ int smb311_posix_get_inode_info(struct inode **inode,struct cifs_fattr fattr = {};int rc; -if (is_inode_cache_good (*inode)) { +if (!data &&is_inode_cache_good (*inode)) {cifs_dbg (FYI ,"No need to revalidate cached inode sizes\n" );return 0 ; } --
Quoted 2 lines
2.48.1
--
Thanks,
Steve
Quoted 2 lines · Horst
thanks, Steve and Paulo! Considering the severity (chmod does not take effect anymore) and the fact that this regression was caused by dropping a condition in two lines of code that is merely being restored by the fix (basically, it's a partial revert), is there any way to prioritize this change as there's no production-ready workaround? It's difficult to avoid updating to 6.6+ at this point.
It has been marked for -stable, so it's expected that stable team will pick it up for v6.6+ once the fix is released in v6.14-rc4. If for some reason they miss it, I'll ping them to make sure it goes into the stable trees.