Skip to contentSkip to conversation

smb/client: return EOPNOTSUPP for unsupported O_TMPFILE

PATCH Applied ChenXiaoSong 3 participants 3 messages Aug 7 – Aug 17

Subsystems (2)
lore
Share & tools
lore

ChenXiaoSong

author reviewer
#0 lore raw

PATCH 1/1 smb/client: return EOPNOTSUPP for unsupported O_TMPFILE

From: ChenXiaoSong <[email protected]>

Some SMB servers return STATUS_OBJECT_NAME_NOT_FOUND or STATUS_DELETE_PENDING when creating an O_TMPFILE. The SMB client maps them to ENOENT.

The ENOENT error is supposed to be returned when the path (a target directory in this case) does not exist, while a lack of support of O_TMPFILE by the target file system should be indicated by EOPNOTSUPP.

Fixes 3e7d63037a2b ("smb: client: add support for O_TMPFILE")
---
 fs/smb/client/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/smb/client/dir.c +2 -0
index 88a4a1787ff0..b0ddcaa2d815 100644
@@ -1138,6 +1138,8 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
 	} while (unlikely(rc == -EEXIST) && ++retries < max_retries);
 
 	if (rc) {
+		if (rc == -ENOENT)
+			rc = -EOPNOTSUPP;
 		cifs_del_pending_open(&open);
 		goto out;
 	}
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · ChenXiaoSong

From: ChenXiaoSong <[email protected]>

Some SMB servers return STATUS_OBJECT_NAME_NOT_FOUND or STATUS_DELETE_PENDING when creating an O_TMPFILE. The SMB client maps them to ENOENT.

The ENOENT error is supposed to be returned when the path (a target directory in this case) does not exist, while a lack of support of O_TMPFILE by the target file system should be indicated by EOPNOTSUPP.

Quoted 4 lines
Fixes 3e7d63037a2b ("smb: client: add support for O_TMPFILE")
maintainer Applied
#2 lore raw
In reply to ChenXiaoSong
Quoted 12 lines · ChenXiaoSong

From: ChenXiaoSong <[email protected]>

Some SMB servers return STATUS_OBJECT_NAME_NOT_FOUND or STATUS_DELETE_PENDING when creating an O_TMPFILE. The SMB client maps them to ENOENT.

The ENOENT error is supposed to be returned when the path (a target directory in this case) does not exist, while a lack of support of O_TMPFILE by the target file system should be indicated by EOPNOTSUPP.

Quoted 4 lines
Fixes 3e7d63037a2b ("smb: client: add support for O_TMPFILE")

Applied it to #for-next with Paulo's acked-by tag. Thanks!