From patchwork Wed Oct 6 19:54:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 236801 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o96JsLaR007930 for ; Wed, 6 Oct 2010 19:54:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759432Ab0JFTyW (ORCPT ); Wed, 6 Oct 2010 15:54:22 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.121]:52422 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786Ab0JFTyU (ORCPT ); Wed, 6 Oct 2010 15:54:20 -0400 X-Authority-Analysis: v=1.1 cv=C0onXBtlORurSwCUfpuzpxmAU2q4LH+bZvnNY+zP63Q= c=1 sm=0 a=u2z0osgi7w0A:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=VnNF1IyMAAAA:8 a=Wvsbd4fKbH-xFf1iLiEA:9 a=3x_JrtibKXJjh5ASTfYA:7 a=EnFFSVnX5ow8b9_9BSrRFl4KnJYA:4 a=jEp0ucaQiEUA:10 a=0kPLrQdw3YYA:10 a=Sud56T0eYsqL9oXP:21 a=La4YQ9T6D1op2dnh:21 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:46097] helo=mail.poochiereds.net) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id E0/51-29346-9E3DCAC4; Wed, 06 Oct 2010 19:54:18 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id BC9635817E; Wed, 6 Oct 2010 15:54:17 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH 02/15] cifs: don't use vfsmount to pin superblock for oplock breaks Date: Wed, 6 Oct 2010 15:54:04 -0400 Message-Id: <1286394857-32541-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1286394857-32541-1-git-send-email-jlayton@redhat.com> References: <1286394857-32541-1-git-send-email-jlayton@redhat.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 06 Oct 2010 19:54:23 +0000 (UTC) diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 9ffe484..f68de99 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h @@ -48,6 +48,7 @@ struct cifs_sb_info { struct nls_table *local_nls; unsigned int rsize; unsigned int wsize; + atomic_t active; uid_t mnt_uid; gid_t mnt_gid; mode_t mnt_file_mode; diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 906b098..241f3d0 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -83,6 +83,24 @@ extern mempool_t *cifs_sm_req_poolp; extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_mid_poolp; +void +cifs_sb_active(struct super_block *sb) +{ + struct cifs_sb_info *server = CIFS_SB(sb); + + if (atomic_inc_return(&server->active) == 1) + atomic_inc(&sb->s_active); +} + +void +cifs_sb_deactive(struct super_block *sb) +{ + struct cifs_sb_info *server = CIFS_SB(sb); + + if (atomic_dec_and_test(&server->active)) + deactivate_super(sb); +} + static int cifs_read_super(struct super_block *sb, void *data, const char *devname, int silent) diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index d82f5fb..2fb3829 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -42,10 +42,8 @@ extern const struct address_space_operations cifs_addr_ops; extern const struct address_space_operations cifs_addr_ops_smallbuf; /* Functions related to super block operations */ -/* extern const struct super_operations cifs_super_ops;*/ -extern void cifs_read_inode(struct inode *); -/*extern void cifs_delete_inode(struct inode *);*/ /* BB not needed yet */ -/* extern void cifs_write_inode(struct inode *); */ /* BB not needed yet */ +extern void cifs_sb_active(struct super_block *sb); +extern void cifs_sb_deactive(struct super_block *sb); /* Functions related to inodes */ extern const struct inode_operations cifs_dir_inode_ops; diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index bbb6552..a019820 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -388,7 +388,6 @@ struct cifsFileInfo { /* lock scope id (0 if none) */ struct file *pfile; /* needed for writepage */ struct dentry *dentry; - struct vfsmount *mnt; struct tcon_link *tlink; struct mutex lock_mutex; struct list_head llist; /* list of byte range locks we have. */ diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 29a2ee8..7f416ab 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -107,7 +107,7 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, - struct vfsmount *mnt, struct tcon_link *tlink, + struct tcon_link *tlink, unsigned int oflags, __u32 oplock); extern int cifs_posix_open(char *full_path, struct inode **pinode, struct super_block *sb, diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 6887c41..c205ec9 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -132,8 +132,7 @@ cifs_bp_rename_retry: struct cifsFileInfo * cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, - struct vfsmount *mnt, struct tcon_link *tlink, - unsigned int oflags, __u32 oplock) + struct tcon_link *tlink, unsigned int oflags, __u32 oplock) { struct dentry *dentry = file->f_path.dentry; struct cifsFileInfo *pCifsFile; @@ -147,7 +146,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, struct file *file, pCifsFile->pid = current->tgid; pCifsFile->uid = current_fsuid(); pCifsFile->dentry = dget(dentry); - pCifsFile->mnt = mnt; pCifsFile->pfile = file; pCifsFile->invalidHandle = false; pCifsFile->closePend = false; @@ -485,8 +483,7 @@ cifs_create_set_dentry: } pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, - nd->path.mnt, tlink, oflags, - oplock); + tlink, oflags, oplock); if (pfile_info == NULL) { fput(filp); CIFSSMBClose(xid, tcon, fileHandle); @@ -760,8 +757,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, } cfile = cifs_new_fileinfo(newInode, fileHandle, filp, - nd->path.mnt, tlink, - nd->intent.open.flags, + tlink, nd->intent.open.flags, oplock); if (cfile == NULL) { fput(filp); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index c302b9c..fd78a35 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 = {