Skip to content

Commit ff60765

Browse files
committed
smb: client: fix chmod(2) regression with ATTR_READONLY
JIRA: https://issues.redhat.com/browse/RHEL-80534 commit 654292a Author: Paulo Alcantara <pc@manguebit.com> Date: Sun Feb 16 18:02:47 2025 -0300 smb: client: fix chmod(2) regression with ATTR_READONLY When the user sets a file or directory as read-only (e.g. ~S_IWUGO), the client will set the ATTR_READONLY attribute by sending an SMB2_SET_INFO request to the server in cifs_setattr_{,nounix}(), but cifsInodeInfo::cifsAttrs will 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 a18280e ("smb: cilent: set reparse mount points as automounts") mistakenly removed the @DaTa NULL check when calling is_inode_cache_good(), which broke the above case as the new ATTR_READONLY attribute 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 <horst.reiterer@fabasoft.com> Closes: https://lore.kernel.org/r/85a16504e09147a195ac0aac1c801280@fabasoft.com Fixes: a18280e ("smb: cilent: set reparse mount points as automounts") Cc: stable@vger.kernel.org Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Paulo Alcantara <paalcant@redhat.com>
1 parent 91caaa2 commit ff60765

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/smb/client/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ int cifs_get_inode_info(struct inode **inode,
14031403
struct cifs_fattr fattr = {};
14041404
int rc;
14051405

1406-
if (is_inode_cache_good(*inode)) {
1406+
if (!data && is_inode_cache_good(*inode)) {
14071407
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
14081408
return 0;
14091409
}
@@ -1502,7 +1502,7 @@ int smb311_posix_get_inode_info(struct inode **inode,
15021502
struct cifs_fattr fattr = {};
15031503
int rc;
15041504

1505-
if (is_inode_cache_good(*inode)) {
1505+
if (!data && is_inode_cache_good(*inode)) {
15061506
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
15071507
return 0;
15081508
}

0 commit comments

Comments
 (0)