diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2013-07-11 02:58:30 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-07-11 19:05:08 -0400 |
commit | b33fcf1c9d359374ef6e8e7ec1e0b6f7a8717e16 (patch) | |
tree | 223595753ad1bf21d34c20528096f6f75a29c7ed /fs | |
parent | 1c46943f84f7532a9503810d44b0772581c0325c (diff) |
CIFS: Reopen the file if reconnect durable handle failed
This is a follow-on patch for 8/8 patch from the durable handles
series. It fixes the problem when durable file handle timeout
expired on the server and reopen returns -ENOENT for such files.
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/file.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ba7eed2ee662..1dc9dea2ae70 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -681,6 +681,13 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) | |||
681 | * not dirty locally we could do this. | 681 | * not dirty locally we could do this. |
682 | */ | 682 | */ |
683 | rc = server->ops->open(xid, &oparms, &oplock, NULL); | 683 | rc = server->ops->open(xid, &oparms, &oplock, NULL); |
684 | if (rc == -ENOENT && oparms.reconnect == false) { | ||
685 | /* durable handle timeout is expired - open the file again */ | ||
686 | rc = server->ops->open(xid, &oparms, &oplock, NULL); | ||
687 | /* indicate that we need to relock the file */ | ||
688 | oparms.reconnect = true; | ||
689 | } | ||
690 | |||
684 | if (rc) { | 691 | if (rc) { |
685 | mutex_unlock(&cfile->fh_mutex); | 692 | mutex_unlock(&cfile->fh_mutex); |
686 | cifs_dbg(FYI, "cifs_reopen returned 0x%x\n", rc); | 693 | cifs_dbg(FYI, "cifs_reopen returned 0x%x\n", rc); |
@@ -1510,7 +1517,6 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, | |||
1510 | if (!rc) | 1517 | if (!rc) |
1511 | goto out; | 1518 | goto out; |
1512 | 1519 | ||
1513 | |||
1514 | /* | 1520 | /* |
1515 | * Windows 7 server can delay breaking lease from read to None | 1521 | * Windows 7 server can delay breaking lease from read to None |
1516 | * if we set a byte-range lock on a file - break it explicitly | 1522 | * if we set a byte-range lock on a file - break it explicitly |