Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1409678
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.14 03/20] remove directory incorrectly tries to set delete on close on non-empty directories |
| Date | 2016-05-31 00:20 +0200 |
| Message-ID | <rEDHr-1Vq-1@gated-at.bofh.it> (permalink) |
| References | <rECs2-VP-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <smfrench@gmail.com>
commit 897fba1172d637d344f009d700f7eb8a1fa262f1 upstream.
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>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/cifs/smb2glob.h | 1 +
fs/cifs/smb2inode.c | 8 ++++++--
fs/cifs/smb2pdu.c | 16 ++++++++++++++++
fs/cifs/smb2proto.h | 2 ++
4 files changed, 25 insertions(+), 2 deletions(-)
--- a/fs/cifs/smb2glob.h
+++ b/fs/cifs/smb2glob.h
@@ -44,6 +44,7 @@
#define SMB2_OP_DELETE 7
#define SMB2_OP_HARDLINK 8
#define SMB2_OP_SET_EOF 9
+#define SMB2_OP_RMDIR 10
/* Used when constructing chained read requests. */
#define CHAINED_REQUEST 1
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -80,6 +80,10 @@ smb2_open_op_close(const unsigned int xi
* 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, struc
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
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2291,6 +2291,22 @@ SMB2_rename(const unsigned int xid, stru
}
int
+SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
+ u64 persistent_fid, u64 volatile_fid)
+{
+ __u8 delete_pending = 1;
+ void *data;
+ unsigned int size;
+
+ data = &delete_pending;
+ size = 1; /* sizeof __u8 */
+
+ return send_set_info(xid, tcon, persistent_fid, volatile_fid,
+ current->tgid, FILE_DISPOSITION_INFORMATION, 1, &data,
+ &size);
+}
+
+int
SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
u64 persistent_fid, u64 volatile_fid, __le16 *target_file)
{
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -134,6 +134,8 @@ extern int SMB2_query_directory(const un
extern int SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
u64 persistent_fid, u64 volatile_fid,
__le16 *target_file);
+extern int SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
+ u64 persistent_fid, u64 volatile_fid);
extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
u64 persistent_fid, u64 volatile_fid,
__le16 *target_file);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.14 00/20] 3.14.71-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
[PATCH 3.14 09/20] mmc: mmc: Fix partition switch timeout for some eMMCs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
[PATCH 3.14 13/20] USB: serial: mxuport: fix use-after-free in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 18/20] USB: serial: option: add support for Cinterion PH8 and AHxx Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 08/20] mfd: omap-usb-tll: Fix scheduling while atomic BUG Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 06/20] ring-buffer: Prevent overflow of size in ring_buffer_resize() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 15/20] USB: serial: quatech2: fix use-after-free in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 11/20] mmc: longer timeout for long read time quirk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 10/20] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 14/20] USB: serial: keyspan: fix use-after-free in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 07/20] crypto: caam - fix caam_jr_alloc() ret code Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 17/20] USB: serial: io_edgeport: fix memory leaks in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
[PATCH 3.14 03/20] remove directory incorrectly tries to set delete on close on non-empty directories Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 04/20] fs/cifs: correctly to anonymous authentication via NTLMSSP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 20/20] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 02/20] arm/arm64: KVM: Enforce Break-Before-Make on Stage-2 page tables Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 19/20] tty: vt, return error when con_startup fails Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 12/20] Bluetooth: vhci: purge unhandled skbs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 05/20] ring-buffer: Use long for nr_pages to avoid overflow failures Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
[PATCH 3.14 01/20] Btrfs: dont use src fd for printk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:20 +0200
Re: [PATCH 3.14 00/20] 3.14.71-stable review Guenter Roeck <linux@roeck-us.net> - 2016-06-01 07:30 +0200
Re: [PATCH 3.14 00/20] 3.14.71-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-06-01 16:30 +0200
Re: [PATCH 3.14 00/20] 3.14.71-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-06-01 18:20 +0200
Re: [PATCH 3.14 00/20] 3.14.71-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-06-01 18:20 +0200
Re: [PATCH 3.14 00/20] 3.14.71-stable review Kevin Hilman <khilman@baylibre.com> - 2016-06-01 19:40 +0200
csiph-web