Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b33fcf1c authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Steve French
Browse files

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: default avatarPavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent 1c46943f
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -681,6 +681,13 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
	 * not dirty locally we could do this.
	 * not dirty locally we could do this.
	 */
	 */
	rc = server->ops->open(xid, &oparms, &oplock, NULL);
	rc = server->ops->open(xid, &oparms, &oplock, NULL);
	if (rc == -ENOENT && oparms.reconnect == false) {
		/* durable handle timeout is expired - open the file again */
		rc = server->ops->open(xid, &oparms, &oplock, NULL);
		/* indicate that we need to relock the file */
		oparms.reconnect = true;
	}

	if (rc) {
	if (rc) {
		mutex_unlock(&cfile->fh_mutex);
		mutex_unlock(&cfile->fh_mutex);
		cifs_dbg(FYI, "cifs_reopen returned 0x%x\n", rc);
		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,
		if (!rc)
		if (!rc)
			goto out;
			goto out;



		/*
		/*
		 * Windows 7 server can delay breaking lease from read to None
		 * Windows 7 server can delay breaking lease from read to None
		 * if we set a byte-range lock on a file - break it explicitly
		 * if we set a byte-range lock on a file - break it explicitly