From d7c86ff8cd00abc730fe5d031f43dc9138b6324e Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 11 Oct 2010 15:07:19 -0400 Subject: cifs: don't use vfsmount to pin superblock for oplock breaks Filesystems aren't really supposed to do anything with a vfsmount. It's considered a layering violation since vfsmounts are entirely managed at the VFS layer. CIFS currently keeps an active reference to a vfsmount in order to prevent the superblock vanishing before an oplock break has completed. What we really want to do instead is to keep sb->s_active high until the oplock break has completed. This patch borrows the scheme that NFS uses for handling sillyrenames. An atomic_t is added to the cifs_sb_info. When it transitions from 0 to 1, an extra reference to the superblock is taken (by bumping the s_active value). When it transitions from 1 to 0, that reference is dropped and a the superblock teardown may proceed if there are no more references to it. Also, the vfsmount pointer is removed from cifsFileInfo and from cifs_new_fileinfo, and some bogus forward declarations are removed from cifsfs.h. Signed-off-by: Jeff Layton Reviewed-by: Suresh Jayaraman Acked-by: Dave Kleikamp Signed-off-by: Steve French --- fs/cifs/file.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'fs/cifs/file.c') diff --git a/fs/cifs/file.c b/fs/cifs/file.c index c302b9c52644..fd78a355f634 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -282,7 +282,6 @@ int cifs_open(struct inode *inode, struct file *file) } pCifsFile = cifs_new_fileinfo(inode, netfid, file, - file->f_path.mnt, tlink, oflags, oplock); if (pCifsFile == NULL) { CIFSSMBClose(xid, tcon, netfid); @@ -375,8 +374,8 @@ int cifs_open(struct inode *inode, struct file *file) if (rc != 0) goto out; - pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, - tlink, file->f_flags, oplock); + pCifsFile = cifs_new_fileinfo(inode, netfid, file, tlink, + file->f_flags, oplock); if (pCifsFile == NULL) { rc = -ENOMEM; goto out; @@ -2381,14 +2380,14 @@ void cifs_oplock_break(struct work_struct *work) void cifs_oplock_break_get(struct cifsFileInfo *cfile) { - mntget(cfile->mnt); + cifs_sb_active(cfile->dentry->d_sb); cifsFileInfo_get(cfile); } void cifs_oplock_break_put(struct cifsFileInfo *cfile) { - mntput(cfile->mnt); cifsFileInfo_put(cfile); + cifs_sb_deactive(cfile->dentry->d_sb); } const struct address_space_operations cifs_addr_ops = { -- cgit v1.2.2