diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 16:20:26 -0700 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 21:46:26 -0500 |
commit | 0ff78a221bf7839a7f20be9929433d17e868e987 (patch) | |
tree | 6d63e90a9928b2a319848fd3403d11bdc8d24147 /fs/cifs | |
parent | fb1214e48f735cdb68446adb77ec37aa3de60697 (diff) | |
download | op-kernel-dev-0ff78a221bf7839a7f20be9929433d17e868e987.zip op-kernel-dev-0ff78a221bf7839a7f20be9929433d17e868e987.tar.gz |
CIFS: Move close code to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsglob.h | 2 | ||||
-rw-r--r-- | fs/cifs/file.c | 10 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 8 |
3 files changed, 17 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index e649fac..39bf2f3 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -269,6 +269,8 @@ struct smb_version_operations { struct cifs_sb_info *); /* set fid protocol-specific info */ void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32); + /* close a file */ + int (*close)(const unsigned int, struct cifs_tcon *, struct cifs_fid *); }; struct smb_version_values { diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 1246cf7..14938ee 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -326,10 +326,13 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) cancel_work_sync(&cifs_file->oplock_break); if (!tcon->need_reconnect && !cifs_file->invalidHandle) { + struct TCP_Server_Info *server = tcon->ses->server; unsigned int xid; - int rc; + int rc = -ENOSYS; + xid = get_xid(); - rc = CIFSSMBClose(xid, tcon, cifs_file->fid.netfid); + if (server->ops->close) + rc = server->ops->close(xid, tcon, &cifs_file->fid); free_xid(xid); } @@ -423,7 +426,8 @@ int cifs_open(struct inode *inode, struct file *file) cfile = cifs_new_fileinfo(&fid, file, tlink, oplock); if (cfile == NULL) { - CIFSSMBClose(xid, tcon, fid.netfid); + if (tcon->ses->server->ops->close) + tcon->ses->server->ops->close(xid, tcon, &fid); rc = -ENOMEM; goto out; } diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 907b308..bb75847 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -634,6 +634,13 @@ cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) cinode->can_cache_brlcks = cinode->clientCanCacheAll; } +static int +cifs_close_file(const unsigned int xid, struct cifs_tcon *tcon, + struct cifs_fid *fid) +{ + return CIFSSMBClose(xid, tcon, fid->netfid); +} + struct smb_version_operations smb1_operations = { .send_cancel = send_nt_cancel, .compare_fids = cifs_compare_fids, @@ -675,6 +682,7 @@ struct smb_version_operations smb1_operations = { .rename_pending_delete = cifs_rename_pending_delete, .open = cifs_open_file, .set_fid = cifs_set_fid, + .close = cifs_close_file, }; struct smb_version_values smb1_values = { |