aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-19 09:22:44 -0400
committerSteve French <smfrench@gmail.com>2012-09-24 22:46:33 -0400
commitb8c32dbb0deb287a5fcb78251e4eae6c7275760d (patch)
treefa3cddfd4595846921f51a922b7e1722b1e35fa4 /fs/cifs/file.c
parent579f9053236c796d718162c37c72bb3bd32d008c (diff)
CIFS: Request SMB2.1 leases
if server supports them and we need oplocks. Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2e2e4f9aeb63..ccad858d2d67 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -177,8 +177,9 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
177 int disposition; 177 int disposition;
178 int create_options = CREATE_NOT_DIR; 178 int create_options = CREATE_NOT_DIR;
179 FILE_ALL_INFO *buf; 179 FILE_ALL_INFO *buf;
180 struct TCP_Server_Info *server = tcon->ses->server;
180 181
181 if (!tcon->ses->server->ops->open) 182 if (!server->ops->open)
182 return -ENOSYS; 183 return -ENOSYS;
183 184
184 desired_access = cifs_convert_flags(f_flags); 185 desired_access = cifs_convert_flags(f_flags);
@@ -218,9 +219,9 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
218 if (backup_cred(cifs_sb)) 219 if (backup_cred(cifs_sb))
219 create_options |= CREATE_OPEN_BACKUP_INTENT; 220 create_options |= CREATE_OPEN_BACKUP_INTENT;
220 221
221 rc = tcon->ses->server->ops->open(xid, tcon, full_path, disposition, 222 rc = server->ops->open(xid, tcon, full_path, disposition,
222 desired_access, create_options, fid, 223 desired_access, create_options, fid, oplock, buf,
223 oplock, buf, cifs_sb); 224 cifs_sb);
224 225
225 if (rc) 226 if (rc)
226 goto out; 227 goto out;
@@ -372,6 +373,7 @@ int cifs_open(struct inode *inode, struct file *file)
372 unsigned int xid; 373 unsigned int xid;
373 __u32 oplock; 374 __u32 oplock;
374 struct cifs_sb_info *cifs_sb; 375 struct cifs_sb_info *cifs_sb;
376 struct TCP_Server_Info *server;
375 struct cifs_tcon *tcon; 377 struct cifs_tcon *tcon;
376 struct tcon_link *tlink; 378 struct tcon_link *tlink;
377 struct cifsFileInfo *cfile = NULL; 379 struct cifsFileInfo *cfile = NULL;
@@ -388,6 +390,7 @@ int cifs_open(struct inode *inode, struct file *file)
388 return PTR_ERR(tlink); 390 return PTR_ERR(tlink);
389 } 391 }
390 tcon = tlink_tcon(tlink); 392 tcon = tlink_tcon(tlink);
393 server = tcon->ses->server;
391 394
392 full_path = build_path_from_dentry(file->f_path.dentry); 395 full_path = build_path_from_dentry(file->f_path.dentry);
393 if (full_path == NULL) { 396 if (full_path == NULL) {
@@ -432,6 +435,9 @@ int cifs_open(struct inode *inode, struct file *file)
432 } 435 }
433 436
434 if (!posix_open_ok) { 437 if (!posix_open_ok) {
438 if (server->ops->get_lease_key)
439 server->ops->get_lease_key(inode, &fid);
440
435 rc = cifs_nt_open(full_path, inode, cifs_sb, tcon, 441 rc = cifs_nt_open(full_path, inode, cifs_sb, tcon,
436 file->f_flags, &oplock, &fid, xid); 442 file->f_flags, &oplock, &fid, xid);
437 if (rc) 443 if (rc)
@@ -440,8 +446,8 @@ int cifs_open(struct inode *inode, struct file *file)
440 446
441 cfile = cifs_new_fileinfo(&fid, file, tlink, oplock); 447 cfile = cifs_new_fileinfo(&fid, file, tlink, oplock);
442 if (cfile == NULL) { 448 if (cfile == NULL) {
443 if (tcon->ses->server->ops->close) 449 if (server->ops->close)
444 tcon->ses->server->ops->close(xid, tcon, &fid); 450 server->ops->close(xid, tcon, &fid);
445 rc = -ENOMEM; 451 rc = -ENOMEM;
446 goto out; 452 goto out;
447 } 453 }
@@ -567,6 +573,9 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
567 if (backup_cred(cifs_sb)) 573 if (backup_cred(cifs_sb))
568 create_options |= CREATE_OPEN_BACKUP_INTENT; 574 create_options |= CREATE_OPEN_BACKUP_INTENT;
569 575
576 if (server->ops->get_lease_key)
577 server->ops->get_lease_key(inode, &fid);
578
570 /* 579 /*
571 * Can not refresh inode by passing in file_info buf to be returned by 580 * Can not refresh inode by passing in file_info buf to be returned by
572 * CIFSSMBOpen and then calling get_inode_info with returned buf since 581 * CIFSSMBOpen and then calling get_inode_info with returned buf since