remove directory incorrectly tries to set delete on close on non-empty directories
Wrong return code was being returned on SMB3 rmdir of non-empty directory. For SMB3 (unlike for cifs), we attempt to delete a directory by set of delete on close flag on the open. Windows clients set this flag via a set info (SET_FILE_DISPOSITION to set this flag) which properly checks if the directory is empty. With this patch on smb3 mounts we correctly return "DIRECTORY NOT EMPTY" on attempts to remove a non-empty directory. Signed-off-by: Steve French <steve.french@primarydata.com> CC: Stable <stable@vger.kernel.org> Acked-by: Sachin Prabhu <sprabhu@redhat.com>
This commit is contained in:
@@ -80,6 +80,10 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
* SMB2_open() call.
|
||||
*/
|
||||
break;
|
||||
case SMB2_OP_RMDIR:
|
||||
tmprc = SMB2_rmdir(xid, tcon, fid.persistent_fid,
|
||||
fid.volatile_fid);
|
||||
break;
|
||||
case SMB2_OP_RENAME:
|
||||
tmprc = SMB2_rename(xid, tcon, fid.persistent_fid,
|
||||
fid.volatile_fid, (__le16 *)data);
|
||||
@@ -191,8 +195,8 @@ smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
|
||||
struct cifs_sb_info *cifs_sb)
|
||||
{
|
||||
return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
|
||||
CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
|
||||
NULL, SMB2_OP_DELETE);
|
||||
CREATE_NOT_FILE,
|
||||
NULL, SMB2_OP_RMDIR);
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user