Commit b65dac32 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update 4.9 to correct sources (eterbug #11619)

parent 3cd9c68e
# #
# 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 cifsencrypt.o \ cifs_unicode.o nterr.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_XATTR) += xattr.o etercifs-$(CONFIG_CIFS_XATTR) += xattr.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
...@@ -1034,6 +1034,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -1034,6 +1034,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;
...@@ -1103,6 +1104,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -1103,6 +1104,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;
......
...@@ -497,6 +497,9 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -497,6 +497,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)
......
...@@ -1032,6 +1032,7 @@ struct cifs_open_parms { ...@@ -1032,6 +1032,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;
...@@ -1081,6 +1082,13 @@ struct cifsFileInfo { ...@@ -1081,6 +1082,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"
......
...@@ -1118,6 +1118,7 @@ psx_create_err: ...@@ -1118,6 +1118,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;
...@@ -1161,6 +1162,7 @@ access_flags_to_smbopen_mode(const int access_flags) ...@@ -1161,6 +1162,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,
...@@ -1169,6 +1171,10 @@ SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1169,6 +1171,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;
...@@ -1266,6 +1272,7 @@ OldOpenRetry: ...@@ -1266,6 +1272,7 @@ OldOpenRetry:
if (rc == -EAGAIN) if (rc == -EAGAIN)
goto OldOpenRetry; goto OldOpenRetry;
return rc; return rc;
#endif
} }
int int
...@@ -1343,7 +1350,7 @@ openRetry: ...@@ -1343,7 +1350,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);
......
...@@ -81,7 +81,7 @@ enum { ...@@ -81,7 +81,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,
...@@ -159,6 +159,7 @@ static const match_table_t cifs_mount_option_tokens = { ...@@ -159,6 +159,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" },
...@@ -1424,6 +1425,10 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1424,6 +1425,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;
......
...@@ -220,6 +220,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -220,6 +220,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;
...@@ -234,6 +235,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -234,6 +235,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,
...@@ -318,6 +320,8 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -318,6 +320,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
...@@ -347,6 +351,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -347,6 +351,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;
...@@ -669,7 +674,6 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -669,7 +674,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);
...@@ -686,6 +690,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -686,6 +690,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;
......
...@@ -178,6 +178,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -178,6 +178,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;
...@@ -214,6 +215,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -214,6 +215,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 */
...@@ -227,6 +229,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, ...@@ -227,6 +229,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;
......
...@@ -461,6 +461,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, ...@@ -461,6 +461,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;
...@@ -1154,6 +1155,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1154,6 +1155,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;
...@@ -1196,7 +1198,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1196,7 +1198,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_remap(cifs_sb)); cifs_remap(cifs_sb));
if (rc != 0) { if (rc != 0) {
rc = -EBUSY; rc = -ETXTBSY;
goto undo_setattr; goto undo_setattr;
} }
...@@ -1215,7 +1217,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, ...@@ -1215,7 +1217,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);
...@@ -1321,13 +1323,15 @@ psx_del_no_retry: ...@@ -1321,13 +1323,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) {
...@@ -1669,7 +1673,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -1669,7 +1673,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 */
...@@ -1680,6 +1684,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, ...@@ -1680,6 +1684,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;
......
...@@ -337,6 +337,7 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -337,6 +337,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;
...@@ -383,6 +384,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ...@@ -383,6 +384,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},
......
...@@ -246,7 +246,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, ...@@ -246,7 +246,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_remap(cifs_sb); cifs_remap(cifs_sb);
if (!rc) { if (!rc) {
......
...@@ -573,6 +573,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -573,6 +573,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;
...@@ -805,6 +806,7 @@ smb_set_file_info(struct inode *inode, const char *full_path, ...@@ -805,6 +806,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;
...@@ -973,6 +975,7 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -973,6 +975,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"},
......
...@@ -308,6 +308,7 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) ...@@ -308,6 +308,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;
...@@ -342,6 +343,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) ...@@ -342,6 +343,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;
...@@ -375,6 +377,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -375,6 +377,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;
...@@ -955,6 +958,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -955,6 +958,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;
...@@ -1042,6 +1046,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1042,6 +1046,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;
...@@ -1121,6 +1126,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1121,6 +1126,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;
......
...@@ -1500,7 +1500,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, ...@@ -1500,7 +1500,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