Skip to content

Commit 654292a

Browse files
Paulo AlcantaraSteve French
authored andcommitted
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>
1 parent 0ad2507 commit 654292a

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
@@ -1408,7 +1408,7 @@ int cifs_get_inode_info(struct inode **inode,
14081408
struct cifs_fattr fattr = {};
14091409
int rc;
14101410

1411-
if (is_inode_cache_good(*inode)) {
1411+
if (!data && is_inode_cache_good(*inode)) {
14121412
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
14131413
return 0;
14141414
}
@@ -1507,7 +1507,7 @@ int smb311_posix_get_inode_info(struct inode **inode,
15071507
struct cifs_fattr fattr = {};
15081508
int rc;
15091509

1510-
if (is_inode_cache_good(*inode)) {
1510+
if (!data && is_inode_cache_good(*inode)) {
15111511
cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
15121512
return 0;
15131513
}

0 commit comments

Comments
 (0)