Skip to content

Commit d1ea35f

Browse files
committed
Merge tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "13 cifs/smb3 patches, most from testing at the SMB3 plugfest this week: - Important fix for multichannel and for modefromsid mounts. - Two reconnect fixes - Addition of SMB3 change notify support - Backup tools fix - A few additional minor debug improvements (tracepoints and additional logging found useful during testing this week)" * tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6: smb3: Add defines for new information level, FileIdInformation smb3: print warning once if posix context returned on open smb3: add one more dynamic tracepoint missing from strict fsync path cifs: fix mode bits from dir listing when mounted with modefromsid cifs: fix channel signing cifs: add SMB3 change notification support cifs: make multichannel warning more visible cifs: fix soft mounts hanging in the reconnect code cifs: Add tracepoints for errors on flush or fsync cifs: log warning message (once) if out of disk space cifs: fail i/o on soft mounts if sessionsetup errors out smb3: fix problem with null cifs super block with previous patch SMB3: Backup intent flag missing from some more ops
2 parents 5586c3c + 51d92d6 commit d1ea35f

22 files changed

+247
-129
lines changed

fs/cifs/cifs_ioctl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,16 @@ struct smb3_key_debug_info {
6565
__u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE];
6666
} __packed;
6767

68+
struct smb3_notify {
69+
__u32 completion_filter;
70+
bool watch_tree;
71+
} __packed;
72+
6873
#define CIFS_IOCTL_MAGIC 0xCF
6974
#define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int)
7075
#define CIFS_IOC_SET_INTEGRITY _IO(CIFS_IOCTL_MAGIC, 4)
7176
#define CIFS_IOC_GET_MNT_INFO _IOR(CIFS_IOCTL_MAGIC, 5, struct smb_mnt_fs_info)
7277
#define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array)
7378
#define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)
7479
#define CIFS_DUMP_KEY _IOWR(CIFS_IOCTL_MAGIC, 8, struct smb3_key_debug_info)
80+
#define CIFS_IOC_NOTIFY _IOW(CIFS_IOCTL_MAGIC, 9, struct smb3_notify)

fs/cifs/cifsacl.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
10841084
struct cifs_ntsd *pntsd = NULL;
10851085
int oplock = 0;
10861086
unsigned int xid;
1087-
int rc, create_options = 0;
1087+
int rc;
10881088
struct cifs_tcon *tcon;
10891089
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
10901090
struct cifs_fid fid;
@@ -1096,13 +1096,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
10961096
tcon = tlink_tcon(tlink);
10971097
xid = get_xid();
10981098

1099-
if (backup_cred(cifs_sb))
1100-
create_options |= CREATE_OPEN_BACKUP_INTENT;
1101-
11021099
oparms.tcon = tcon;
11031100
oparms.cifs_sb = cifs_sb;
11041101
oparms.desired_access = READ_CONTROL;
1105-
oparms.create_options = create_options;
1102+
oparms.create_options = cifs_create_options(cifs_sb, 0);
11061103
oparms.disposition = FILE_OPEN;
11071104
oparms.path = path;
11081105
oparms.fid = &fid;
@@ -1147,7 +1144,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
11471144
{
11481145
int oplock = 0;
11491146
unsigned int xid;
1150-
int rc, access_flags, create_options = 0;
1147+
int rc, access_flags;
11511148
struct cifs_tcon *tcon;
11521149
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
11531150
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
@@ -1160,9 +1157,6 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
11601157
tcon = tlink_tcon(tlink);
11611158
xid = get_xid();
11621159

1163-
if (backup_cred(cifs_sb))
1164-
create_options |= CREATE_OPEN_BACKUP_INTENT;
1165-
11661160
if (aclflag == CIFS_ACL_OWNER || aclflag == CIFS_ACL_GROUP)
11671161
access_flags = WRITE_OWNER;
11681162
else
@@ -1171,7 +1165,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
11711165
oparms.tcon = tcon;
11721166
oparms.cifs_sb = cifs_sb;
11731167
oparms.desired_access = access_flags;
1174-
oparms.create_options = create_options;
1168+
oparms.create_options = cifs_create_options(cifs_sb, 0);
11751169
oparms.disposition = FILE_OPEN;
11761170
oparms.path = path;
11771171
oparms.fid = &fid;

fs/cifs/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
275275
buf->f_ffree = 0; /* unlimited */
276276

277277
if (server->ops->queryfs)
278-
rc = server->ops->queryfs(xid, tcon, buf);
278+
rc = server->ops->queryfs(xid, tcon, cifs_sb, buf);
279279

280280
free_xid(xid);
281281
return 0;

fs/cifs/cifsglob.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ struct smb_version_operations {
298298
const char *, struct dfs_info3_param **,
299299
unsigned int *, const struct nls_table *, int);
300300
/* informational QFS call */
301-
void (*qfs_tcon)(const unsigned int, struct cifs_tcon *);
301+
void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
302+
struct cifs_sb_info *);
302303
/* check if a path is accessible or not */
303304
int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
304305
struct cifs_sb_info *, const char *);
@@ -409,7 +410,7 @@ struct smb_version_operations {
409410
struct cifsInodeInfo *);
410411
/* query remote filesystem */
411412
int (*queryfs)(const unsigned int, struct cifs_tcon *,
412-
struct kstatfs *);
413+
struct cifs_sb_info *, struct kstatfs *);
413414
/* send mandatory brlock to the server */
414415
int (*mand_lock)(const unsigned int, struct cifsFileInfo *, __u64,
415416
__u64, __u32, int, int, bool);
@@ -430,6 +431,8 @@ struct smb_version_operations {
430431
struct cifsFileInfo *src_file);
431432
int (*enum_snapshots)(const unsigned int xid, struct cifs_tcon *tcon,
432433
struct cifsFileInfo *src_file, void __user *);
434+
int (*notify)(const unsigned int xid, struct file *pfile,
435+
void __user *pbuf);
433436
int (*query_mf_symlink)(unsigned int, struct cifs_tcon *,
434437
struct cifs_sb_info *, const unsigned char *,
435438
char *, unsigned int *);
@@ -490,6 +493,7 @@ struct smb_version_operations {
490493
/* ioctl passthrough for query_info */
491494
int (*ioctl_query_info)(const unsigned int xid,
492495
struct cifs_tcon *tcon,
496+
struct cifs_sb_info *cifs_sb,
493497
__le16 *path, int is_dir,
494498
unsigned long p);
495499
/* make unix special files (block, char, fifo, socket) */

fs/cifs/cifsproto.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,4 +612,12 @@ static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
612612
}
613613
#endif
614614

615+
static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)
616+
{
617+
if (cifs_sb && (backup_cred(cifs_sb)))
618+
return options | CREATE_OPEN_BACKUP_INTENT;
619+
else
620+
return options;
621+
}
622+
615623
#endif /* _CIFSPROTO_H */

fs/cifs/cifssmb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
260260
if (server->tcpStatus != CifsNeedReconnect)
261261
break;
262262

263-
if (--retries)
263+
if (retries && --retries)
264264
continue;
265265

266266
/*

fs/cifs/connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4365,7 +4365,7 @@ static int mount_get_conns(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
43654365

43664366
/* do not care if a following call succeed - informational */
43674367
if (!tcon->pipe && server->ops->qfs_tcon) {
4368-
server->ops->qfs_tcon(*xid, tcon);
4368+
server->ops->qfs_tcon(*xid, tcon, cifs_sb);
43694369
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE) {
43704370
if (tcon->fsDevInfo.DeviceCharacteristics &
43714371
cpu_to_le32(FILE_READ_ONLY_DEVICE))

fs/cifs/dir.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,10 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
355355
if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
356356
create_options |= CREATE_OPTION_READONLY;
357357

358-
if (backup_cred(cifs_sb))
359-
create_options |= CREATE_OPEN_BACKUP_INTENT;
360-
361358
oparms.tcon = tcon;
362359
oparms.cifs_sb = cifs_sb;
363360
oparms.desired_access = desired_access;
364-
oparms.create_options = create_options;
361+
oparms.create_options = cifs_create_options(cifs_sb, create_options);
365362
oparms.disposition = disposition;
366363
oparms.path = full_path;
367364
oparms.fid = fid;

fs/cifs/file.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
222222
if (!buf)
223223
return -ENOMEM;
224224

225-
if (backup_cred(cifs_sb))
226-
create_options |= CREATE_OPEN_BACKUP_INTENT;
227-
228225
/* O_SYNC also has bit for O_DSYNC so following check picks up either */
229226
if (f_flags & O_SYNC)
230227
create_options |= CREATE_WRITE_THROUGH;
@@ -235,7 +232,7 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
235232
oparms.tcon = tcon;
236233
oparms.cifs_sb = cifs_sb;
237234
oparms.desired_access = desired_access;
238-
oparms.create_options = create_options;
235+
oparms.create_options = cifs_create_options(cifs_sb, create_options);
239236
oparms.disposition = disposition;
240237
oparms.path = full_path;
241238
oparms.fid = fid;
@@ -752,9 +749,6 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
752749

753750
desired_access = cifs_convert_flags(cfile->f_flags);
754751

755-
if (backup_cred(cifs_sb))
756-
create_options |= CREATE_OPEN_BACKUP_INTENT;
757-
758752
/* O_SYNC also has bit for O_DSYNC so following check picks up either */
759753
if (cfile->f_flags & O_SYNC)
760754
create_options |= CREATE_WRITE_THROUGH;
@@ -768,7 +762,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
768762
oparms.tcon = tcon;
769763
oparms.cifs_sb = cifs_sb;
770764
oparms.desired_access = desired_access;
771-
oparms.create_options = create_options;
765+
oparms.create_options = cifs_create_options(cifs_sb, create_options);
772766
oparms.disposition = disposition;
773767
oparms.path = full_path;
774768
oparms.fid = &cfile->fid;
@@ -2599,8 +2593,10 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
25992593
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
26002594

26012595
rc = file_write_and_wait_range(file, start, end);
2602-
if (rc)
2596+
if (rc) {
2597+
trace_cifs_fsync_err(inode->i_ino, rc);
26032598
return rc;
2599+
}
26042600

26052601
xid = get_xid();
26062602

@@ -2638,8 +2634,10 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
26382634
struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
26392635

26402636
rc = file_write_and_wait_range(file, start, end);
2641-
if (rc)
2637+
if (rc) {
2638+
trace_cifs_fsync_err(file_inode(file)->i_ino, rc);
26422639
return rc;
2640+
}
26432641

26442642
xid = get_xid();
26452643

@@ -2672,7 +2670,8 @@ int cifs_flush(struct file *file, fl_owner_t id)
26722670
rc = filemap_write_and_wait(inode->i_mapping);
26732671

26742672
cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
2675-
2673+
if (rc)
2674+
trace_cifs_flush_err(inode->i_ino, rc);
26762675
return rc;
26772676
}
26782677

fs/cifs/inode.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
475475
oparms.tcon = tcon;
476476
oparms.cifs_sb = cifs_sb;
477477
oparms.desired_access = GENERIC_READ;
478-
oparms.create_options = CREATE_NOT_DIR;
479-
if (backup_cred(cifs_sb))
480-
oparms.create_options |= CREATE_OPEN_BACKUP_INTENT;
478+
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR);
481479
oparms.disposition = FILE_OPEN;
482480
oparms.path = path;
483481
oparms.fid = &fid;
@@ -1285,7 +1283,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
12851283
oparms.tcon = tcon;
12861284
oparms.cifs_sb = cifs_sb;
12871285
oparms.desired_access = DELETE | FILE_WRITE_ATTRIBUTES;
1288-
oparms.create_options = CREATE_NOT_DIR;
1286+
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR);
12891287
oparms.disposition = FILE_OPEN;
12901288
oparms.path = full_path;
12911289
oparms.fid = &fid;
@@ -1823,7 +1821,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
18231821
oparms.cifs_sb = cifs_sb;
18241822
/* open the file to be renamed -- we need DELETE perms */
18251823
oparms.desired_access = DELETE;
1826-
oparms.create_options = CREATE_NOT_DIR;
1824+
oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR);
18271825
oparms.disposition = FILE_OPEN;
18281826
oparms.path = from_path;
18291827
oparms.fid = &fid;

0 commit comments

Comments
 (0)