Skip to content

Commit 4bf5516

Browse files
committed
smb: client: fix chmod(2) regression with ATTR_READONLY
JIRA: https://issues.redhat.com/browse/RHEL-80527 Y-JIRA: https://issues.redhat.com/browse/RHEL-78507 Y-Commit: c7cbda5 O-JIRA: https://issues.redhat.com/browse/RHEL-78507 Upstream Status: https://git.samba.org/sfrench/cifs-2.6.git commit 654292a Author: Paulo Alcantara <[email protected]> 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 <[email protected]> Closes: https://lore.kernel.org/r/[email protected] Fixes: a18280e ("smb: cilent: set reparse mount points as automounts") Cc: [email protected] Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]> Signed-off-by: Paulo Alcantara <[email protected]> Signed-off-by: Jay Shin <[email protected]>
1 parent c0218fe commit 4bf5516

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
@@ -1389,7 +1389,7 @@ int cifs_get_inode_info(struct inode **inode,
13891389
struct cifs_fattr fattr = {};
13901390
int rc;
13911391

1392-
if (is_inode_cache_good(*inode)) {
1392+
if (!data && is_inode_cache_good(*inode)) {
13931393
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
13941394
return 0;
13951395
}
@@ -1488,7 +1488,7 @@ int smb311_posix_get_inode_info(struct inode **inode,
14881488
struct cifs_fattr fattr = {};
14891489
int rc;
14901490

1491-
if (is_inode_cache_good(*inode)) {
1491+
if (!data && is_inode_cache_good(*inode)) {
14921492
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
14931493
return 0;
14941494
}

0 commit comments

Comments
 (0)