From patchwork Tue Oct 27 23:24:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Garlick X-Patchwork-Id: 56195 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9RNPRt6012435 for ; Tue, 27 Oct 2009 23:25:27 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by h25xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1N2vP3-0008ST-93; Tue, 27 Oct 2009 23:24:37 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by h25xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1N2vP2-0008SO-5W for v9fs-developer@lists.sourceforge.net; Tue, 27 Oct 2009 23:24:36 +0000 Received-SPF: pass (1b2kzd1.ch3.sourceforge.com: domain of llnl.gov designates 128.115.41.83 as permitted sender) client-ip=128.115.41.83; envelope-from=garlick@llnl.gov; helo=smtp.llnl.gov; Received: from nspiron-3.llnl.gov ([128.115.41.83] helo=smtp.llnl.gov) by 1b2kzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1N2vOv-000890-0a for v9fs-developer@lists.sourceforge.net; Tue, 27 Oct 2009 23:24:35 +0000 X-Attachments: None Received: from eris.llnl.gov ([134.9.2.84]) by smtp.llnl.gov with ESMTP; 27 Oct 2009 16:24:22 -0700 Received: from localhost (mrhankey [192.168.1.135]) by eris.llnl.gov (Postfix) with ESMTP id CB6767C4A5; Tue, 27 Oct 2009 16:24:21 -0700 (PDT) Date: Tue, 27 Oct 2009 16:24:18 -0700 From: Jim Garlick To: Eric Van Hensbergen Message-ID: <20091027232418.GA7574@llnl.gov> References: <20090928173402.GA5731@llnl.gov> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i X-Spam-Score: -5.5 (-----) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [128.115.41.83 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1N2vOv-000890-0a Cc: Latchesar Ionkov , V9FS Developers , rminnich@dancer.ca.sandia.gov Subject: Re: [V9fs-developer] Small patch X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net Index: include/net/9p/client.h =================================================================== --- include/net/9p/client.h (revision 9145) +++ include/net/9p/client.h (working copy) @@ -178,6 +178,7 @@ void *aux; int rdir_fpos; + struct mutex rdir_lock; struct list_head flist; struct list_head dlist; /* list of all fids attached to a dentry */ }; Index: v9fs/vfs_dir.c =================================================================== --- v9fs/vfs_dir.c (revision 9137) +++ v9fs/vfs_dir.c (working copy) @@ -84,6 +84,9 @@ if (!statbuf) return -ENOMEM; + if ((err = mutex_lock_interruptible(&fid->rdir_lock))) + goto free_and_exit; + while (1) { if (fid->rdir_fpos > filp->f_pos) { n = fid->rdir_fpos - filp->f_pos; @@ -129,6 +132,7 @@ i += reclen; } } + mutex_unlock(&fid->rdir_lock); free_and_exit: kfree(statbuf); Index: 9p/client.c =================================================================== --- 9p/client.c (revision 9145) +++ 9p/client.c (working copy) @@ -589,6 +589,7 @@ memset(&fid->qid, 0, sizeof(struct p9_qid)); fid->mode = -1; fid->rdir_fpos = 0; + mutex_init(&fid->rdir_lock); fid->uid = current_fsuid(); fid->clnt = clnt; fid->aux = NULL; mrhankey /home/garlick/work/v9fs > vi v9fs/vfs_dir.c mrhankey /home/garlick/work/v9fs > svn diff Index: include/net/9p/client.h =================================================================== --- include/net/9p/client.h (revision 9145) +++ include/net/9p/client.h (working copy) @@ -178,6 +178,7 @@ void *aux; int rdir_fpos; + struct mutex rdir_lock; struct list_head flist; struct list_head dlist; /* list of all fids attached to a dentry */ }; Index: v9fs/vfs_dir.c =================================================================== --- v9fs/vfs_dir.c (revision 9137) +++ v9fs/vfs_dir.c (working copy) @@ -84,6 +84,9 @@ if (!statbuf) return -ENOMEM; + if ((err = mutex_lock_interruptible(&fid->rdir_lock))) + goto free_and_exit; + while (1) { if (fid->rdir_fpos > filp->f_pos) { n = fid->rdir_fpos - filp->f_pos; @@ -129,6 +132,7 @@ i += reclen; } } + mutex_unlock(&fid->rdir_lock); free_and_exit: kfree(statbuf); Index: 9p/client.c =================================================================== --- 9p/client.c (revision 9145) +++ 9p/client.c (working copy) @@ -589,6 +589,7 @@ memset(&fid->qid, 0, sizeof(struct p9_qid)); fid->mode = -1; fid->rdir_fpos = 0; + mutex_init(&fid->rdir_lock); fid->uid = current_fsuid(); fid->clnt = clnt; fid->aux = NULL;