Commit 47c78f4a authored by Sachin Prabhu's avatar Sachin Prabhu Committed by Steve French

cifs: map NT_STATUS_SHARING_VIOLATION to EBUSY instead of ETXTBSY

NT_SHARING_VIOLATION errors are mapped to ETXTBSY which is unexpected
for operations such as unlink where we can hit these errors.

The patch maps the error NT_SHARING_VIOLATION to EBUSY instead. The
patch also replaces all instances of ETXTBSY in
cifs_rename_pending_delete() with EBUSY.
Signed-off-by: default avatarSachin Prabhu <sprabhu@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 6c23cbbd
...@@ -1043,7 +1043,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1043,7 +1043,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc != 0) { if (rc != 0) {
rc = -ETXTBSY; rc = -EBUSY;
goto undo_setattr; goto undo_setattr;
} }
...@@ -1062,7 +1062,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1062,7 +1062,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
if (rc == -ENOENT) if (rc == -ENOENT)
rc = 0; rc = 0;
else if (rc != 0) { else if (rc != 0) {
rc = -ETXTBSY; rc = -EBUSY;
goto undo_rename; goto undo_rename;
} }
cifsInode->delete_pending = true; cifsInode->delete_pending = true;
...@@ -1169,15 +1169,13 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1169,15 +1169,13 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
cifs_drop_nlink(inode); cifs_drop_nlink(inode);
} else if (rc == -ENOENT) { } else if (rc == -ENOENT) {
d_drop(dentry); d_drop(dentry);
} else if (rc == -ETXTBSY) { } else if (rc == -EBUSY) {
if (server->ops->rename_pending_delete) { if (server->ops->rename_pending_delete) {
rc = server->ops->rename_pending_delete(full_path, rc = server->ops->rename_pending_delete(full_path,
dentry, xid); dentry, xid);
if (rc == 0) if (rc == 0)
cifs_drop_nlink(inode); cifs_drop_nlink(inode);
} }
if (rc == -ETXTBSY)
rc = -EBUSY;
} else if ((rc == -EACCES) && (dosattr == 0) && inode) { } else if ((rc == -EACCES) && (dosattr == 0) && inode) {
attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); attrs = kzalloc(sizeof(*attrs), GFP_KERNEL);
if (attrs == NULL) { if (attrs == NULL) {
...@@ -1518,7 +1516,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -1518,7 +1516,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
* source. Note that cross directory moves do not work with * source. Note that cross directory moves do not work with
* rename by filehandle to various Windows servers. * rename by filehandle to various Windows servers.
*/ */
if (rc == 0 || rc != -ETXTBSY) if (rc == 0 || rc != -EBUSY)
goto do_rename_exit; goto do_rename_exit;
/* open-file renames don't work across directories */ /* open-file renames don't work across directories */
......
...@@ -62,7 +62,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { ...@@ -62,7 +62,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
{ERRdiffdevice, -EXDEV}, {ERRdiffdevice, -EXDEV},
{ERRnofiles, -ENOENT}, {ERRnofiles, -ENOENT},
{ERRwriteprot, -EROFS}, {ERRwriteprot, -EROFS},
{ERRbadshare, -ETXTBSY}, {ERRbadshare, -EBUSY},
{ERRlock, -EACCES}, {ERRlock, -EACCES},
{ERRunsup, -EINVAL}, {ERRunsup, -EINVAL},
{ERRnosuchshare, -ENXIO}, {ERRnosuchshare, -ENXIO},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment