Commit dcdfaeb3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update 3.16 up to real 3.16.53 + Etersoft's patches

parent 892812f0
# #
# Makefile for Linux CIFS VFS client # Makefile for Linux CIFS VFS client
# #
obj-$(CONFIG_CIFS) += cifs.o obj-$(CONFIG_CIFS) += etercifs.o
cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \ etercifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \
link.o misc.o netmisc.o smbencrypt.o transport.o asn1.o \ link.o misc.o netmisc.o smbencrypt.o transport.o asn1.o \
cifs_unicode.o nterr.o xattr.o cifsencrypt.o \ cifs_unicode.o nterr.o xattr.o cifsencrypt.o \
readdir.o ioctl.o sess.o export.o smb1ops.o winucase.o readdir.o ioctl.o sess.o export.o smb1ops.o winucase.o
cifs-$(CONFIG_CIFS_ACL) += cifsacl.o etercifs-$(CONFIG_CIFS_ACL) += cifsacl.o
cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o etercifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o etercifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o etercifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o \ etercifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o \
smb2misc.o smb2pdu.o smb2inode.o smb2file.o smb2misc.o smb2pdu.o smb2inode.o smb2file.o
...@@ -913,6 +913,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -913,6 +913,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = READ_CONTROL; oparms.desired_access = READ_CONTROL;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = path; oparms.path = path;
...@@ -982,6 +983,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -982,6 +983,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = access_flags; oparms.desired_access = access_flags;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = path; oparms.path = path;
......
...@@ -472,6 +472,9 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -472,6 +472,9 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
seq_puts(s, ",mfsymlinks"); seq_puts(s, ",mfsymlinks");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE)
seq_puts(s, ",fsc"); seq_puts(s, ",fsc");
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) &&
(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL))
seq_puts(s, ",wine");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)
seq_puts(s, ",nostrictsync"); seq_puts(s, ",nostrictsync");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
......
...@@ -978,6 +978,7 @@ struct cifs_open_parms { ...@@ -978,6 +978,7 @@ struct cifs_open_parms {
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
int disposition; int disposition;
int desired_access; int desired_access;
int share_access;
int create_options; int create_options;
const char *path; const char *path;
struct cifs_fid *fid; struct cifs_fid *fid;
...@@ -1025,6 +1026,13 @@ struct cifsFileInfo { ...@@ -1025,6 +1026,13 @@ struct cifsFileInfo {
struct work_struct oplock_break; /* work for oplock breaks */ struct work_struct oplock_break; /* work for oplock breaks */
}; };
#define SHARE_FLAGS_SHIFT 28
static inline int cifs_get_share_flags(unsigned int flags)
{
return (~(flags >> SHARE_FLAGS_SHIFT)) & 7;
}
struct cifs_io_parms { struct cifs_io_parms {
__u16 netfid; __u16 netfid;
#ifdef CONFIG_CIFS_SMB2 #ifdef CONFIG_CIFS_SMB2
......
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
#ifndef _CIFSPDU_H #ifndef _CIFSPDU_H
#define _CIFSPDU_H #define _CIFSPDU_H
#ifndef CONFIG_CIFS_XATTR
#define CONFIG_CIFS_XATTR
#endif
#ifndef CONFIG_CIFS_POSIX
#define CONFIG_CIFS_POSIX
#endif
#include <net/sock.h> #include <net/sock.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "smbfsctl.h" #include "smbfsctl.h"
......
...@@ -1124,6 +1124,7 @@ psx_create_err: ...@@ -1124,6 +1124,7 @@ psx_create_err:
return rc; return rc;
} }
#ifdef ETERSOFT_USE_SMB_LEGACY_OPEN
static __u16 convert_disposition(int disposition) static __u16 convert_disposition(int disposition)
{ {
__u16 ofun = 0; __u16 ofun = 0;
...@@ -1167,6 +1168,7 @@ access_flags_to_smbopen_mode(const int access_flags) ...@@ -1167,6 +1168,7 @@ access_flags_to_smbopen_mode(const int access_flags)
/* just go for read/write */ /* just go for read/write */
return SMBOPEN_READWRITE; return SMBOPEN_READWRITE;
} }
#endif
int int
SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
...@@ -1175,6 +1177,10 @@ SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1175,6 +1177,10 @@ SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
int *pOplock, FILE_ALL_INFO *pfile_info, int *pOplock, FILE_ALL_INFO *pfile_info,
const struct nls_table *nls_codepage, int remap) const struct nls_table *nls_codepage, int remap)
{ {
#ifndef ETERSOFT_USE_SMB_LEGACY_OPEN
printk("Etersoft: Do not use SMBLegacyOpen!\n");
return -EACCES;
#else
int rc = -EACCES; int rc = -EACCES;
OPENX_REQ *pSMB = NULL; OPENX_REQ *pSMB = NULL;
OPENX_RSP *pSMBr = NULL; OPENX_RSP *pSMBr = NULL;
...@@ -1273,6 +1279,7 @@ OldOpenRetry: ...@@ -1273,6 +1279,7 @@ OldOpenRetry:
if (rc == -EAGAIN) if (rc == -EAGAIN)
goto OldOpenRetry; goto OldOpenRetry;
return rc; return rc;
#endif
} }
int int
...@@ -1350,7 +1357,7 @@ openRetry: ...@@ -1350,7 +1357,7 @@ openRetry:
if (create_options & CREATE_OPTION_READONLY) if (create_options & CREATE_OPTION_READONLY)
req->FileAttributes |= cpu_to_le32(ATTR_READONLY); req->FileAttributes |= cpu_to_le32(ATTR_READONLY);
req->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); req->ShareAccess = cpu_to_le32(oparms->share_access);
req->CreateDisposition = cpu_to_le32(disposition); req->CreateDisposition = cpu_to_le32(disposition);
req->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); req->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK);
......
...@@ -84,7 +84,7 @@ enum { ...@@ -84,7 +84,7 @@ enum {
Opt_nointr, Opt_intr, Opt_nointr, Opt_intr,
Opt_nostrictsync, Opt_strictsync, Opt_nostrictsync, Opt_strictsync,
Opt_serverino, Opt_noserverino, Opt_serverino, Opt_noserverino,
Opt_rwpidforward, Opt_cifsacl, Opt_nocifsacl, Opt_rwpidforward, Opt_wine, Opt_cifsacl, Opt_nocifsacl,
Opt_acl, Opt_noacl, Opt_locallease, Opt_acl, Opt_noacl, Opt_locallease,
Opt_sign, Opt_seal, Opt_noac, Opt_sign, Opt_seal, Opt_noac,
Opt_fsc, Opt_mfsymlinks, Opt_fsc, Opt_mfsymlinks,
...@@ -156,6 +156,7 @@ static const match_table_t cifs_mount_option_tokens = { ...@@ -156,6 +156,7 @@ static const match_table_t cifs_mount_option_tokens = {
{ Opt_serverino, "serverino" }, { Opt_serverino, "serverino" },
{ Opt_noserverino, "noserverino" }, { Opt_noserverino, "noserverino" },
{ Opt_rwpidforward, "rwpidforward" }, { Opt_rwpidforward, "rwpidforward" },
{ Opt_wine, "wine" },
{ Opt_cifsacl, "cifsacl" }, { Opt_cifsacl, "cifsacl" },
{ Opt_nocifsacl, "nocifsacl" }, { Opt_nocifsacl, "nocifsacl" },
{ Opt_acl, "acl" }, { Opt_acl, "acl" },
...@@ -1434,6 +1435,10 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1434,6 +1435,10 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
case Opt_rwpidforward: case Opt_rwpidforward:
vol->rwpidforward = 1; vol->rwpidforward = 1;
break; break;
case Opt_wine:
vol->strict_io = 1;
vol->mand_lock = 1;
break;
case Opt_cifsacl: case Opt_cifsacl:
vol->cifs_acl = 1; vol->cifs_acl = 1;
break; break;
......
...@@ -226,6 +226,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -226,6 +226,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
FILE_ALL_INFO *buf = NULL; FILE_ALL_INFO *buf = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
int disposition; int disposition;
int share_access;
struct TCP_Server_Info *server = tcon->ses->server; struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_open_parms oparms; struct cifs_open_parms oparms;
...@@ -240,6 +241,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -240,6 +241,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
} }
if (tcon->unix_ext && cap_unix(tcon->ses) && !tcon->broken_posix_open && if (tcon->unix_ext && cap_unix(tcon->ses) && !tcon->broken_posix_open &&
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP & (CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
rc = cifs_posix_open(full_path, &newinode, inode->i_sb, mode, rc = cifs_posix_open(full_path, &newinode, inode->i_sb, mode,
...@@ -324,6 +326,8 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -324,6 +326,8 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
else else
cifs_dbg(FYI, "Create flag not set in create function\n"); cifs_dbg(FYI, "Create flag not set in create function\n");
share_access = cifs_get_share_flags(oflags);
/* /*
* BB add processing to set equivalent of mode - e.g. via CreateX with * BB add processing to set equivalent of mode - e.g. via CreateX with
* ACLs * ACLs
...@@ -353,6 +357,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -353,6 +357,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = desired_access; oparms.desired_access = desired_access;
oparms.share_access = share_access;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = disposition; oparms.disposition = disposition;
oparms.path = full_path; oparms.path = full_path;
...@@ -668,7 +673,6 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -668,7 +673,6 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL))
goto mknod_out; goto mknod_out;
cifs_dbg(FYI, "sfu compat create special file\n"); cifs_dbg(FYI, "sfu compat create special file\n");
buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
...@@ -685,6 +689,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -685,6 +689,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = GENERIC_WRITE; oparms.desired_access = GENERIC_WRITE;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = FILE_CREATE; oparms.disposition = FILE_CREATE;
oparms.path = full_path; oparms.path = full_path;
......
...@@ -179,6 +179,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -179,6 +179,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
{ {
int rc; int rc;
int desired_access; int desired_access;
int share_access;
int disposition; int disposition;
int create_options = CREATE_NOT_DIR; int create_options = CREATE_NOT_DIR;
FILE_ALL_INFO *buf; FILE_ALL_INFO *buf;
...@@ -215,6 +216,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -215,6 +216,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
*********************************************************************/ *********************************************************************/
disposition = cifs_get_disposition(f_flags); disposition = cifs_get_disposition(f_flags);
share_access = cifs_get_share_flags(f_flags);
/* BB pass O_SYNC flag through on file attributes .. BB */ /* BB pass O_SYNC flag through on file attributes .. BB */
...@@ -235,6 +237,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -235,6 +237,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = desired_access; oparms.desired_access = desired_access;
oparms.share_access = share_access;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = disposition; oparms.disposition = disposition;
oparms.path = full_path; oparms.path = full_path;
...@@ -490,8 +493,9 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -490,8 +493,9 @@ int cifs_open(struct inode *inode, struct file *file)
else else
oplock = 0; oplock = 0;
if (!tcon->broken_posix_open && tcon->unix_ext && if (!tcon->broken_posix_open && tcon->unix_ext && cap_unix(tcon->ses)
cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
/* can not refresh inode info since size could be stale */ /* can not refresh inode info since size could be stale */
rc = cifs_posix_open(full_path, &inode, inode->i_sb, rc = cifs_posix_open(full_path, &inode, inode->i_sb,
...@@ -613,6 +617,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -613,6 +617,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
struct inode *inode; struct inode *inode;
char *full_path = NULL; char *full_path = NULL;
int desired_access; int desired_access;
int share_access;
int disposition = FILE_OPEN; int disposition = FILE_OPEN;
int create_options = CREATE_NOT_DIR; int create_options = CREATE_NOT_DIR;
struct cifs_open_parms oparms; struct cifs_open_parms oparms;
...@@ -654,6 +659,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -654,6 +659,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
oplock = 0; oplock = 0;
if (tcon->unix_ext && cap_unix(tcon->ses) && if (tcon->unix_ext && cap_unix(tcon->ses) &&
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP & (CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
/* /*
...@@ -678,6 +684,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -678,6 +684,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
} }
desired_access = cifs_convert_flags(cfile->f_flags); desired_access = cifs_convert_flags(cfile->f_flags);
share_access = cifs_get_share_flags(cfile->f_flags);
if (backup_cred(cifs_sb)) if (backup_cred(cifs_sb))
create_options |= CREATE_OPEN_BACKUP_INTENT; create_options |= CREATE_OPEN_BACKUP_INTENT;
...@@ -688,6 +695,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -688,6 +695,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = desired_access; oparms.desired_access = desired_access;
oparms.share_access = share_access;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = disposition; oparms.disposition = disposition;
oparms.path = full_path; oparms.path = full_path;
......
...@@ -445,6 +445,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, ...@@ -445,6 +445,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = GENERIC_READ; oparms.desired_access = GENERIC_READ;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = CREATE_NOT_DIR; oparms.create_options = CREATE_NOT_DIR;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = path; oparms.path = path;
...@@ -1095,6 +1096,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1095,6 +1096,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = DELETE | FILE_WRITE_ATTRIBUTES; oparms.desired_access = DELETE | FILE_WRITE_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = CREATE_NOT_DIR; oparms.create_options = CREATE_NOT_DIR;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = full_path; oparms.path = full_path;
...@@ -1138,7 +1140,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1138,7 +1140,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 = -EBUSY; rc = -ETXTBSY;
goto undo_setattr; goto undo_setattr;
} }
...@@ -1157,7 +1159,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1157,7 +1159,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 = -EBUSY; rc = -ETXTBSY;
goto undo_rename; goto undo_rename;
} }
set_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags); set_bit(CIFS_INO_DELETE_PENDING, &cifsInode->flags);
...@@ -1264,13 +1266,15 @@ psx_del_no_retry: ...@@ -1264,13 +1266,15 @@ psx_del_no_retry:
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 == -EBUSY) { } else if (rc == -ETXTBSY) {
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) {
...@@ -1614,7 +1618,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -1614,7 +1618,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 != -EBUSY) if (rc == 0 || rc != -ETXTBSY)
goto do_rename_exit; goto do_rename_exit;
/* open-file renames don't work across directories */ /* open-file renames don't work across directories */
...@@ -1625,6 +1629,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -1625,6 +1629,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
/* open the file to be renamed -- we need DELETE perms */ /* open the file to be renamed -- we need DELETE perms */
oparms.desired_access = DELETE; oparms.desired_access = DELETE;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = CREATE_NOT_DIR; oparms.create_options = CREATE_NOT_DIR;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = from_path; oparms.path = from_path;
......
...@@ -333,6 +333,7 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -333,6 +333,7 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = GENERIC_READ; oparms.desired_access = GENERIC_READ;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = CREATE_NOT_DIR; oparms.create_options = CREATE_NOT_DIR;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = path; oparms.path = path;
...@@ -377,6 +378,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -377,6 +378,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = GENERIC_WRITE; oparms.desired_access = GENERIC_WRITE;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.disposition = FILE_CREATE; oparms.disposition = FILE_CREATE;
oparms.path = path; oparms.path = path;
......
...@@ -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, -EBUSY}, {ERRbadshare, -ETXTBSY},
{ERRlock, -EACCES}, {ERRlock, -EACCES},
{ERRunsup, -EINVAL}, {ERRunsup, -EINVAL},
{ERRnosuchshare, -ENXIO}, {ERRnosuchshare, -ENXIO},
......
...@@ -241,7 +241,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, ...@@ -241,7 +241,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
char *tmpbuffer; char *tmpbuffer;
rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ, rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
OPEN_REPARSE_POINT, &fid, &oplock, NULL, FILE_SHARE_ALL, OPEN_REPARSE_POINT, &fid, &oplock, NULL,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (!rc) { if (!rc) {
......
...@@ -576,6 +576,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -576,6 +576,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = 0; oparms.create_options = 0;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = full_path; oparms.path = full_path;
...@@ -812,6 +813,7 @@ smb_set_file_info(struct inode *inode, const char *full_path, ...@@ -812,6 +813,7 @@ smb_set_file_info(struct inode *inode, const char *full_path,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = SYNCHRONIZE | FILE_WRITE_ATTRIBUTES; oparms.desired_access = SYNCHRONIZE | FILE_WRITE_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = CREATE_NOT_DIR; oparms.create_options = CREATE_NOT_DIR;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = full_path; oparms.path = full_path;
...@@ -984,6 +986,7 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -984,6 +986,7 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.cifs_sb = cifs_sb; oparms.cifs_sb = cifs_sb;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.create_options = OPEN_REPARSE_POINT; oparms.create_options = OPEN_REPARSE_POINT;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.path = full_path; oparms.path = full_path;
......
...@@ -55,6 +55,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -55,6 +55,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = desired_access; oparms.desired_access = desired_access;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = create_disposition; oparms.disposition = create_disposition;
oparms.create_options = create_options; oparms.create_options = create_options;
oparms.fid = &fid; oparms.fid = &fid;
......
...@@ -358,7 +358,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { ...@@ -358,7 +358,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = {
{STATUS_PORT_CONNECTION_REFUSED, -ECONNREFUSED, {STATUS_PORT_CONNECTION_REFUSED, -ECONNREFUSED,
"STATUS_PORT_CONNECTION_REFUSED"}, "STATUS_PORT_CONNECTION_REFUSED"},
{STATUS_INVALID_PORT_HANDLE, -EIO, "STATUS_INVALID_PORT_HANDLE"}, {STATUS_INVALID_PORT_HANDLE, -EIO, "STATUS_INVALID_PORT_HANDLE"},
{STATUS_SHARING_VIOLATION, -EBUSY, "STATUS_SHARING_VIOLATION"}, {STATUS_SHARING_VIOLATION, -ETXTBSY, "STATUS_SHARING_VIOLATION"},
{STATUS_QUOTA_EXCEEDED, -EDQUOT, "STATUS_QUOTA_EXCEEDED"}, {STATUS_QUOTA_EXCEEDED, -EDQUOT, "STATUS_QUOTA_EXCEEDED"},
{STATUS_INVALID_PAGE_PROTECTION, -EIO, {STATUS_INVALID_PAGE_PROTECTION, -EIO,
"STATUS_INVALID_PAGE_PROTECTION"}, "STATUS_INVALID_PAGE_PROTECTION"},
......
...@@ -244,6 +244,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) ...@@ -244,6 +244,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = &fid; oparms.fid = &fid;
...@@ -278,6 +279,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) ...@@ -278,6 +279,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = &fid; oparms.fid = &fid;
...@@ -311,6 +313,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -311,6 +313,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = &fid; oparms.fid = &fid;
...@@ -721,6 +724,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -721,6 +724,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = fid; oparms.fid = fid;
...@@ -808,6 +812,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -808,6 +812,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = &fid; oparms.fid = &fid;
...@@ -887,6 +892,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -887,6 +892,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.share_access = FILE_SHARE_ALL;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = 0; oparms.create_options = 0;
oparms.fid = &fid; oparms.fid = &fid;
......
...@@ -1153,7 +1153,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, ...@@ -1153,7 +1153,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
req->DesiredAccess = cpu_to_le32(oparms->desired_access); req->DesiredAccess = cpu_to_le32(oparms->desired_access);
/* File attributes ignored on open (used in create though) */ /* File attributes ignored on open (used in create though) */
req->FileAttributes = cpu_to_le32(file_attributes); req->FileAttributes = cpu_to_le32(file_attributes);
req->ShareAccess = FILE_SHARE_ALL_LE; req->ShareAccess = cpu_to_le32(oparms->share_access);
req->CreateDisposition = cpu_to_le32(oparms->disposition); req->CreateDisposition = cpu_to_le32(oparms->disposition);
req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK); req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);
uni_path_len = (2 * UniStrnlen((wchar_t *)path, PATH_MAX)) + 2; uni_path_len = (2 * UniStrnlen((wchar_t *)path, PATH_MAX)) + 2;
......
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