aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-15 18:27:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-15 18:27:02 -0400
commit1319a2856dfdd6b4613530e771fe108f00dfc661 (patch)
tree47f4895266cc68cc9fbc8ab596cbecca387d26a8
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
parent67b4c889cc835a2a6e2ff4e20544a33e37e2875d (diff)
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "A set of minor cifs fixes" * 'for-next' of git://git.samba.org/sfrench/cifs-2.6: [CIFS] Minor cleanup of xattr query function fs: cifs: transport: Use time_after for time comparison SMB2: Fix share type handling cifs: cifsacl: Use a temporary ops variable to reduce code length Don't delay freeing mids when blocked on slow socket write of request CIFS: silence lockdep splat in cifs_relock_file()
-rw-r--r--fs/cifs/cifsacl.c30
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/cifsproto.h3
-rw-r--r--fs/cifs/cifssmb.c11
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/cifs/inode.c3
-rw-r--r--fs/cifs/smb2pdu.c21
-rw-r--r--fs/cifs/transport.c4
-rw-r--r--fs/cifs/xattr.c6
9 files changed, 33 insertions, 49 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 15bac390dff9..b98436f5c7c7 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -1135,20 +1135,19 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
1135 u32 acllen = 0; 1135 u32 acllen = 0;
1136 int rc = 0; 1136 int rc = 0;
1137 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 1137 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
1138 struct cifs_tcon *tcon; 1138 struct smb_version_operations *ops;
1139 1139
1140 cifs_dbg(NOISY, "converting ACL to mode for %s\n", path); 1140 cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
1141 1141
1142 if (IS_ERR(tlink)) 1142 if (IS_ERR(tlink))
1143 return PTR_ERR(tlink); 1143 return PTR_ERR(tlink);
1144 tcon = tlink_tcon(tlink);
1145 1144
1146 if (pfid && (tcon->ses->server->ops->get_acl_by_fid)) 1145 ops = tlink_tcon(tlink)->ses->server->ops;
1147 pntsd = tcon->ses->server->ops->get_acl_by_fid(cifs_sb, pfid, 1146
1148 &acllen); 1147 if (pfid && (ops->get_acl_by_fid))
1149 else if (tcon->ses->server->ops->get_acl) 1148 pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen);
1150 pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, 1149 else if (ops->get_acl)
1151 &acllen); 1150 pntsd = ops->get_acl(cifs_sb, inode, path, &acllen);
1152 else { 1151 else {
1153 cifs_put_tlink(tlink); 1152 cifs_put_tlink(tlink);
1154 return -EOPNOTSUPP; 1153 return -EOPNOTSUPP;
@@ -1181,23 +1180,23 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1181 struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ 1180 struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
1182 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1181 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1183 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); 1182 struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
1184 struct cifs_tcon *tcon; 1183 struct smb_version_operations *ops;
1185 1184
1186 if (IS_ERR(tlink)) 1185 if (IS_ERR(tlink))
1187 return PTR_ERR(tlink); 1186 return PTR_ERR(tlink);
1188 tcon = tlink_tcon(tlink); 1187
1188 ops = tlink_tcon(tlink)->ses->server->ops;
1189 1189
1190 cifs_dbg(NOISY, "set ACL from mode for %s\n", path); 1190 cifs_dbg(NOISY, "set ACL from mode for %s\n", path);
1191 1191
1192 /* Get the security descriptor */ 1192 /* Get the security descriptor */
1193 1193
1194 if (tcon->ses->server->ops->get_acl == NULL) { 1194 if (ops->get_acl == NULL) {
1195 cifs_put_tlink(tlink); 1195 cifs_put_tlink(tlink);
1196 return -EOPNOTSUPP; 1196 return -EOPNOTSUPP;
1197 } 1197 }
1198 1198
1199 pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, 1199 pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen);
1200 &secdesclen);
1201 if (IS_ERR(pntsd)) { 1200 if (IS_ERR(pntsd)) {
1202 rc = PTR_ERR(pntsd); 1201 rc = PTR_ERR(pntsd);
1203 cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); 1202 cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc);
@@ -1224,13 +1223,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
1224 1223
1225 cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); 1224 cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc);
1226 1225
1227 if (tcon->ses->server->ops->set_acl == NULL) 1226 if (ops->set_acl == NULL)
1228 rc = -EOPNOTSUPP; 1227 rc = -EOPNOTSUPP;
1229 1228
1230 if (!rc) { 1229 if (!rc) {
1231 /* Set the security descriptor */ 1230 /* Set the security descriptor */
1232 rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode, 1231 rc = ops->set_acl(pnntsd, secdesclen, inode, path, aclflag);
1233 path, aclflag);
1234 cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); 1232 cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc);
1235 } 1233 }
1236 cifs_put_tlink(tlink); 1234 cifs_put_tlink(tlink);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 8be55be70faf..bcc7d9acad64 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -418,7 +418,7 @@ struct smb_version_operations {
418 int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); 418 int (*validate_negotiate)(const unsigned int, struct cifs_tcon *);
419 ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *, 419 ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *,
420 const unsigned char *, const unsigned char *, char *, 420 const unsigned char *, const unsigned char *, char *,
421 size_t, const struct nls_table *, int); 421 size_t, struct cifs_sb_info *);
422 int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *, 422 int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
423 const char *, const void *, const __u16, 423 const char *, const void *, const __u16,
424 const struct nls_table *, int); 424 const struct nls_table *, int);
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index e49958c3f8bb..6eb3147132e3 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -480,8 +480,7 @@ extern int CIFSSMBCopy(unsigned int xid,
480extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, 480extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
481 const unsigned char *searchName, 481 const unsigned char *searchName,
482 const unsigned char *ea_name, char *EAData, 482 const unsigned char *ea_name, char *EAData,
483 size_t bufsize, const struct nls_table *nls_codepage, 483 size_t bufsize, struct cifs_sb_info *cifs_sb);
484 int remap_special_chars);
485extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon, 484extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
486 const char *fileName, const char *ea_name, 485 const char *fileName, const char *ea_name,
487 const void *ea_value, const __u16 ea_value_len, 486 const void *ea_value, const __u16 ea_value_len,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4c01b3f9abf0..fbb0d4cbda41 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -697,9 +697,7 @@ cifs_echo_callback(struct mid_q_entry *mid)
697{ 697{
698 struct TCP_Server_Info *server = mid->callback_data; 698 struct TCP_Server_Info *server = mid->callback_data;
699 699
700 mutex_lock(&server->srv_mutex);
701 DeleteMidQEntry(mid); 700 DeleteMidQEntry(mid);
702 mutex_unlock(&server->srv_mutex);
703 add_credits(server, 1, CIFS_ECHO_OP); 701 add_credits(server, 1, CIFS_ECHO_OP);
704} 702}
705 703
@@ -1599,9 +1597,7 @@ cifs_readv_callback(struct mid_q_entry *mid)
1599 } 1597 }
1600 1598
1601 queue_work(cifsiod_wq, &rdata->work); 1599 queue_work(cifsiod_wq, &rdata->work);
1602 mutex_lock(&server->srv_mutex);
1603 DeleteMidQEntry(mid); 1600 DeleteMidQEntry(mid);
1604 mutex_unlock(&server->srv_mutex);
1605 add_credits(server, 1, 0); 1601 add_credits(server, 1, 0);
1606} 1602}
1607 1603
@@ -2058,7 +2054,6 @@ cifs_writev_callback(struct mid_q_entry *mid)
2058{ 2054{
2059 struct cifs_writedata *wdata = mid->callback_data; 2055 struct cifs_writedata *wdata = mid->callback_data;
2060 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); 2056 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
2061 struct TCP_Server_Info *server = tcon->ses->server;
2062 unsigned int written; 2057 unsigned int written;
2063 WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf; 2058 WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf;
2064 2059
@@ -2095,9 +2090,7 @@ cifs_writev_callback(struct mid_q_entry *mid)
2095 } 2090 }
2096 2091
2097 queue_work(cifsiod_wq, &wdata->work); 2092 queue_work(cifsiod_wq, &wdata->work);
2098 mutex_lock(&server->srv_mutex);
2099 DeleteMidQEntry(mid); 2093 DeleteMidQEntry(mid);
2100 mutex_unlock(&server->srv_mutex);
2101 add_credits(tcon->ses->server, 1, 0); 2094 add_credits(tcon->ses->server, 1, 0);
2102} 2095}
2103 2096
@@ -6076,11 +6069,13 @@ ssize_t
6076CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon, 6069CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
6077 const unsigned char *searchName, const unsigned char *ea_name, 6070 const unsigned char *searchName, const unsigned char *ea_name,
6078 char *EAData, size_t buf_size, 6071 char *EAData, size_t buf_size,
6079 const struct nls_table *nls_codepage, int remap) 6072 struct cifs_sb_info *cifs_sb)
6080{ 6073{
6081 /* BB assumes one setup word */ 6074 /* BB assumes one setup word */
6082 TRANSACTION2_QPI_REQ *pSMB = NULL; 6075 TRANSACTION2_QPI_REQ *pSMB = NULL;
6083 TRANSACTION2_QPI_RSP *pSMBr = NULL; 6076 TRANSACTION2_QPI_RSP *pSMBr = NULL;
6077 int remap = cifs_remap(cifs_sb);
6078 struct nls_table *nls_codepage = cifs_sb->local_nls;
6084 int rc = 0; 6079 int rc = 0;
6085 int bytes_returned; 6080 int bytes_returned;
6086 int list_len; 6081 int list_len;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 6ef78ad838e6..0fd081bd2a2f 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -582,7 +582,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
582 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 582 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
583 int rc = 0; 583 int rc = 0;
584 584
585 down_read(&cinode->lock_sem); 585 down_read_nested(&cinode->lock_sem, SINGLE_DEPTH_NESTING);
586 if (cinode->can_cache_brlcks) { 586 if (cinode->can_cache_brlcks) {
587 /* can cache locks - no need to relock */ 587 /* can cache locks - no need to relock */
588 up_read(&cinode->lock_sem); 588 up_read(&cinode->lock_sem);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index c3b2fa0b2ec8..4d1fcd76d022 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -563,8 +563,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
563 563
564 rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path, 564 rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path,
565 "SETFILEBITS", ea_value, 4 /* size of buf */, 565 "SETFILEBITS", ea_value, 4 /* size of buf */,
566 cifs_sb->local_nls, 566 cifs_sb);
567 cifs_remap(cifs_sb));
568 cifs_put_tlink(tlink); 567 cifs_put_tlink(tlink);
569 if (rc < 0) 568 if (rc < 0)
570 return (int)rc; 569 return (int)rc;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 48ff7703b919..e4afdaae743f 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1240,15 +1240,19 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
1240 goto tcon_exit; 1240 goto tcon_exit;
1241 } 1241 }
1242 1242
1243 if (rsp->ShareType & SMB2_SHARE_TYPE_DISK) 1243 switch (rsp->ShareType) {
1244 case SMB2_SHARE_TYPE_DISK:
1244 cifs_dbg(FYI, "connection to disk share\n"); 1245 cifs_dbg(FYI, "connection to disk share\n");
1245 else if (rsp->ShareType & SMB2_SHARE_TYPE_PIPE) { 1246 break;
1247 case SMB2_SHARE_TYPE_PIPE:
1246 tcon->ipc = true; 1248 tcon->ipc = true;
1247 cifs_dbg(FYI, "connection to pipe share\n"); 1249 cifs_dbg(FYI, "connection to pipe share\n");
1248 } else if (rsp->ShareType & SMB2_SHARE_TYPE_PRINT) { 1250 break;
1249 tcon->print = true; 1251 case SMB2_SHARE_TYPE_PRINT:
1252 tcon->ipc = true;
1250 cifs_dbg(FYI, "connection to printer\n"); 1253 cifs_dbg(FYI, "connection to printer\n");
1251 } else { 1254 break;
1255 default:
1252 cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType); 1256 cifs_dbg(VFS, "unknown share type %d\n", rsp->ShareType);
1253 rc = -EOPNOTSUPP; 1257 rc = -EOPNOTSUPP;
1254 goto tcon_error_exit; 1258 goto tcon_error_exit;
@@ -2173,9 +2177,7 @@ smb2_echo_callback(struct mid_q_entry *mid)
2173 if (mid->mid_state == MID_RESPONSE_RECEIVED) 2177 if (mid->mid_state == MID_RESPONSE_RECEIVED)
2174 credits_received = le16_to_cpu(rsp->hdr.sync_hdr.CreditRequest); 2178 credits_received = le16_to_cpu(rsp->hdr.sync_hdr.CreditRequest);
2175 2179
2176 mutex_lock(&server->srv_mutex);
2177 DeleteMidQEntry(mid); 2180 DeleteMidQEntry(mid);
2178 mutex_unlock(&server->srv_mutex);
2179 add_credits(server, credits_received, CIFS_ECHO_OP); 2181 add_credits(server, credits_received, CIFS_ECHO_OP);
2180} 2182}
2181 2183
@@ -2433,9 +2435,7 @@ smb2_readv_callback(struct mid_q_entry *mid)
2433 cifs_stats_fail_inc(tcon, SMB2_READ_HE); 2435 cifs_stats_fail_inc(tcon, SMB2_READ_HE);
2434 2436
2435 queue_work(cifsiod_wq, &rdata->work); 2437 queue_work(cifsiod_wq, &rdata->work);
2436 mutex_lock(&server->srv_mutex);
2437 DeleteMidQEntry(mid); 2438 DeleteMidQEntry(mid);
2438 mutex_unlock(&server->srv_mutex);
2439 add_credits(server, credits_received, 0); 2439 add_credits(server, credits_received, 0);
2440} 2440}
2441 2441
@@ -2594,7 +2594,6 @@ smb2_writev_callback(struct mid_q_entry *mid)
2594{ 2594{
2595 struct cifs_writedata *wdata = mid->callback_data; 2595 struct cifs_writedata *wdata = mid->callback_data;
2596 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); 2596 struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
2597 struct TCP_Server_Info *server = tcon->ses->server;
2598 unsigned int written; 2597 unsigned int written;
2599 struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; 2598 struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf;
2600 unsigned int credits_received = 1; 2599 unsigned int credits_received = 1;
@@ -2634,9 +2633,7 @@ smb2_writev_callback(struct mid_q_entry *mid)
2634 cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); 2633 cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
2635 2634
2636 queue_work(cifsiod_wq, &wdata->work); 2635 queue_work(cifsiod_wq, &wdata->work);
2637 mutex_lock(&server->srv_mutex);
2638 DeleteMidQEntry(mid); 2636 DeleteMidQEntry(mid);
2639 mutex_unlock(&server->srv_mutex);
2640 add_credits(tcon->ses->server, credits_received, 0); 2637 add_credits(tcon->ses->server, credits_received, 0);
2641} 2638}
2642 2639
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4d64b5b8fc9c..47a125ece11e 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -94,7 +94,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
94 now = jiffies; 94 now = jiffies;
95 /* commands taking longer than one second are indications that 95 /* commands taking longer than one second are indications that
96 something is wrong, unless it is quite a slow link or server */ 96 something is wrong, unless it is quite a slow link or server */
97 if ((now - midEntry->when_alloc) > HZ) { 97 if (time_after(now, midEntry->when_alloc + HZ)) {
98 if ((cifsFYI & CIFS_TIMER) && (midEntry->command != command)) { 98 if ((cifsFYI & CIFS_TIMER) && (midEntry->command != command)) {
99 pr_debug(" CIFS slow rsp: cmd %d mid %llu", 99 pr_debug(" CIFS slow rsp: cmd %d mid %llu",
100 midEntry->command, midEntry->mid); 100 midEntry->command, midEntry->mid);
@@ -613,9 +613,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
613 } 613 }
614 spin_unlock(&GlobalMid_Lock); 614 spin_unlock(&GlobalMid_Lock);
615 615
616 mutex_lock(&server->srv_mutex);
617 DeleteMidQEntry(mid); 616 DeleteMidQEntry(mid);
618 mutex_unlock(&server->srv_mutex);
619 return rc; 617 return rc;
620} 618}
621 619
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 20af5187ba63..3cb5c9e2d4e7 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -235,8 +235,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
235 235
236 if (pTcon->ses->server->ops->query_all_EAs) 236 if (pTcon->ses->server->ops->query_all_EAs)
237 rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, 237 rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
238 full_path, name, value, size, 238 full_path, name, value, size, cifs_sb);
239 cifs_sb->local_nls, cifs_remap(cifs_sb));
240 break; 239 break;
241 240
242 case XATTR_CIFS_ACL: { 241 case XATTR_CIFS_ACL: {
@@ -336,8 +335,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
336 335
337 if (pTcon->ses->server->ops->query_all_EAs) 336 if (pTcon->ses->server->ops->query_all_EAs)
338 rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, 337 rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon,
339 full_path, NULL, data, buf_size, 338 full_path, NULL, data, buf_size, cifs_sb);
340 cifs_sb->local_nls, cifs_remap(cifs_sb));
341list_ea_exit: 339list_ea_exit:
342 kfree(full_path); 340 kfree(full_path);
343 free_xid(xid); 341 free_xid(xid);