aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-09 13:15:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-09 13:15:13 -0500
commitbc4caf186fb691ad56adbe578d356a262f3a7d10 (patch)
tree0290e79f1e42cf659e9d2773255fb6f0aa18219e /fs
parentfa82dcbf2aed65dc3ea78eaca9ea56fd926b2b10 (diff)
parent6ac79291fb7dae4402b306789b1cb85f84687e44 (diff)
Merge tag '4.20-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Three small fixes: a fix for smb3 direct i/o, a fix for CIFS DFS for stable and a minor cifs Kconfig fix" * tag '4.20-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: CIFS: Avoid returning EBUSY to upper layer VFS cifs: Fix separator when building path from dentry cifs: In Kconfig CONFIG_CIFS_POSIX needs depends on legacy (insecure cifs)
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/Kconfig2
-rw-r--r--fs/cifs/dir.c2
-rw-r--r--fs/cifs/file.c31
3 files changed, 8 insertions, 27 deletions
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index abcd78e332fe..85dadb93c992 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -133,7 +133,7 @@ config CIFS_XATTR
133 133
134config CIFS_POSIX 134config CIFS_POSIX
135 bool "CIFS POSIX Extensions" 135 bool "CIFS POSIX Extensions"
136 depends on CIFS_XATTR 136 depends on CIFS && CIFS_ALLOW_INSECURE_LEGACY && CIFS_XATTR
137 help 137 help
138 Enabling this option will cause the cifs client to attempt to 138 Enabling this option will cause the cifs client to attempt to
139 negotiate a newer dialect with servers, such as Samba 3.0.5 139 negotiate a newer dialect with servers, such as Samba 3.0.5
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 3713d22b95a7..907e85d65bb4 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -174,7 +174,7 @@ cifs_bp_rename_retry:
174 174
175 cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath); 175 cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath);
176 memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1); 176 memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1);
177 full_path[dfsplen] = '\\'; 177 full_path[dfsplen] = dirsep;
178 for (i = 0; i < pplen-1; i++) 178 for (i = 0; i < pplen-1; i++)
179 if (full_path[dfsplen+1+i] == '/') 179 if (full_path[dfsplen+1+i] == '/')
180 full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb); 180 full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 74c33d5fafc8..c9bc56b1baac 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2541,14 +2541,13 @@ static int
2541cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list, 2541cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
2542 struct cifs_aio_ctx *ctx) 2542 struct cifs_aio_ctx *ctx)
2543{ 2543{
2544 int wait_retry = 0;
2545 unsigned int wsize, credits; 2544 unsigned int wsize, credits;
2546 int rc; 2545 int rc;
2547 struct TCP_Server_Info *server = 2546 struct TCP_Server_Info *server =
2548 tlink_tcon(wdata->cfile->tlink)->ses->server; 2547 tlink_tcon(wdata->cfile->tlink)->ses->server;
2549 2548
2550 /* 2549 /*
2551 * Try to resend this wdata, waiting for credits up to 3 seconds. 2550 * Wait for credits to resend this wdata.
2552 * Note: we are attempting to resend the whole wdata not in segments 2551 * Note: we are attempting to resend the whole wdata not in segments
2553 */ 2552 */
2554 do { 2553 do {
@@ -2556,19 +2555,13 @@ cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
2556 server, wdata->bytes, &wsize, &credits); 2555 server, wdata->bytes, &wsize, &credits);
2557 2556
2558 if (rc) 2557 if (rc)
2559 break; 2558 goto out;
2560 2559
2561 if (wsize < wdata->bytes) { 2560 if (wsize < wdata->bytes) {
2562 add_credits_and_wake_if(server, credits, 0); 2561 add_credits_and_wake_if(server, credits, 0);
2563 msleep(1000); 2562 msleep(1000);
2564 wait_retry++;
2565 } 2563 }
2566 } while (wsize < wdata->bytes && wait_retry < 3); 2564 } while (wsize < wdata->bytes);
2567
2568 if (wsize < wdata->bytes) {
2569 rc = -EBUSY;
2570 goto out;
2571 }
2572 2565
2573 rc = -EAGAIN; 2566 rc = -EAGAIN;
2574 while (rc == -EAGAIN) { 2567 while (rc == -EAGAIN) {
@@ -3234,14 +3227,13 @@ static int cifs_resend_rdata(struct cifs_readdata *rdata,
3234 struct list_head *rdata_list, 3227 struct list_head *rdata_list,
3235 struct cifs_aio_ctx *ctx) 3228 struct cifs_aio_ctx *ctx)
3236{ 3229{
3237 int wait_retry = 0;
3238 unsigned int rsize, credits; 3230 unsigned int rsize, credits;
3239 int rc; 3231 int rc;
3240 struct TCP_Server_Info *server = 3232 struct TCP_Server_Info *server =
3241 tlink_tcon(rdata->cfile->tlink)->ses->server; 3233 tlink_tcon(rdata->cfile->tlink)->ses->server;
3242 3234
3243 /* 3235 /*
3244 * Try to resend this rdata, waiting for credits up to 3 seconds. 3236 * Wait for credits to resend this rdata.
3245 * Note: we are attempting to resend the whole rdata not in segments 3237 * Note: we are attempting to resend the whole rdata not in segments
3246 */ 3238 */
3247 do { 3239 do {
@@ -3249,24 +3241,13 @@ static int cifs_resend_rdata(struct cifs_readdata *rdata,
3249 &rsize, &credits); 3241 &rsize, &credits);
3250 3242
3251 if (rc) 3243 if (rc)
3252 break; 3244 goto out;
3253 3245
3254 if (rsize < rdata->bytes) { 3246 if (rsize < rdata->bytes) {
3255 add_credits_and_wake_if(server, credits, 0); 3247 add_credits_and_wake_if(server, credits, 0);
3256 msleep(1000); 3248 msleep(1000);
3257 wait_retry++;
3258 } 3249 }
3259 } while (rsize < rdata->bytes && wait_retry < 3); 3250 } while (rsize < rdata->bytes);
3260
3261 /*
3262 * If we can't find enough credits to send this rdata
3263 * release the rdata and return failure, this will pass
3264 * whatever I/O amount we have finished to VFS.
3265 */
3266 if (rsize < rdata->bytes) {
3267 rc = -EBUSY;
3268 goto out;
3269 }
3270 3251
3271 rc = -EAGAIN; 3252 rc = -EAGAIN;
3272 while (rc == -EAGAIN) { 3253 while (rc == -EAGAIN) {