All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	"J. R. Okajima" <hooanon05@yahoo.co.jp>,
	linux-nfs@vger.kernel.org, Wu Fengguang <fengguang.wu@intel.com>,
	Peter Zijlstra <peterz@infradead.org>, Jan Kara <jack@suse.cz>,
	Steve Rago <sar@nec-labs.com>, Jens Axboe <jens.axboe@oracle.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH 10/12] NFS: Simplify nfs_wb_page()
Date: Wed, 17 Mar 2010 13:52:05 -0400	[thread overview]
Message-ID: <20100317135205.58731824@tlielax.poochiereds.net> (raw)
In-Reply-To: <1268846819.8335.3.camel@localhost.localdomain>

On Wed, 17 Mar 2010 13:26:59 -0400
Trond Myklebust <Trond.Myklebust@netapp.com> wrote:

> On Wed, 2010-03-17 at 12:49 -0400, Christoph Hellwig wrote: 
> > On Thu, Mar 11, 2010 at 09:26:22AM -0500, Trond Myklebust wrote:
> > > @@ -112,12 +112,10 @@ void nfs_unlock_request(struct nfs_page *req)
> > >   */
> > >  int nfs_set_page_tag_locked(struct nfs_page *req)
> > >  {
> > > -	struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode);
> > > -
> > >  	if (!nfs_lock_request_dontget(req))
> > >  		return 0;
> > >  	if (req->wb_page != NULL)
> > > -		radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED);
> > > +		radix_tree_tag_set(&NFS_I(req->wb_context->path.dentry->d_inode)->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED);
> > >  	return 1;
> > >  }
> > >  
> > 
> > This hunk is not only entirely unrealted to the fix, but also osbfucates
> > the code.
> > 
> > > @@ -126,10 +124,10 @@ int nfs_set_page_tag_locked(struct nfs_page *req)
> > >   */
> > >  void nfs_clear_page_tag_locked(struct nfs_page *req)
> > >  {
> > > -	struct inode *inode = req->wb_context->path.dentry->d_inode;
> > > -	struct nfs_inode *nfsi = NFS_I(inode);
> > > -
> > >  	if (req->wb_page != NULL) {
> > > +		struct inode *inode = req->wb_context->path.dentry->d_inode;
> > > +		struct nfs_inode *nfsi = NFS_I(inode);
> > > +
> > >  		spin_lock(&inode->i_lock);
> > >  		radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED);
> > >  		nfs_unlock_request(req);
> > 
> > Another one unrelated to the fix.
> > 
> 
> No. They are needed because we don't want to dereference req->wb_context
> after it (and req->wb_page) have been cleared. Without these 2 hunks,
> the resulting kernel Oopses.
> 

It seems like that just tightens up the race window without actually
closing it.

Just because wb_page was non-NULL when you checked it gives no
guarantee that wb_context won't be NULL when you go to dereference it,
right?

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2010-03-17 17:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25 22:15 [PATCH 00/12] Re: [PATCH] improve the performance of large sequential write NFS workloads Trond Myklebust
2010-01-25 22:15 ` [PATCH 05/12] VM/NFS: The VM must tell the filesystem when to free reclaimable pages Trond Myklebust
     [not found] ` <20100125221544.16750.70574.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-25 22:15   ` [PATCH 04/12] NFS: Reduce the number of unnecessary COMMIT calls Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 03/12] NFS: Cleanup - move nfs_write_inode() into fs/nfs/write.c Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 06/12] NFS: Run COMMIT as an asynchronous RPC call when wbc->for_background is set Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 09/12] NFS: Replace __nfs_write_mapping with sync_inode() Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
     [not found]     ` <20100125221545.16750.63968.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-01-26 11:21       ` Christoph Hellwig
2010-01-26 11:21         ` Christoph Hellwig
     [not found]         ` <20100126112148.GA25170-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2010-01-26 14:02           ` Trond Myklebust
2010-01-26 14:02             ` Trond Myklebust
2010-01-26 23:17           ` Trond Myklebust
2010-01-26 23:17             ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 07/12] NFS: Ensure inode is always marked I_DIRTY_DATASYNC, if it has unstable pages Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 01/12] VM: Split out the accounting of unstable writes from BDI_RECLAIMABLE Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 02/12] VM: Don't call bdi_stat(BDI_UNSTABLE) on non-nfs backing-devices Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 08/12] NFS: Simplify nfs_wb_page_cancel() Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15   ` [PATCH 10/12] NFS: Simplify nfs_wb_page() Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
     [not found]     ` <20100125221545.16750.19154.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-10 18:51       ` J. R. Okajima
2010-03-10 18:51         ` J. R. Okajima
2010-03-10 19:31         ` Trond Myklebust
2010-03-10 19:31           ` Trond Myklebust
     [not found]           ` <1268249482.3096.76.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-10 20:18             ` Trond Myklebust
2010-03-10 20:18               ` Trond Myklebust
     [not found]               ` <1268252300.3096.81.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-11  4:45                 ` J. R. Okajima
2010-03-11  4:45                   ` J. R. Okajima
2010-03-11 14:26                   ` Trond Myklebust
2010-03-11 14:26                     ` Trond Myklebust
     [not found]                     ` <1268317582.3354.9.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-12  4:22                       ` J. R. Okajima
2010-03-12  4:22                         ` J. R. Okajima
2010-03-17 16:49                       ` Christoph Hellwig
2010-03-17 16:49                         ` Christoph Hellwig
2010-03-17 17:26                         ` Trond Myklebust
2010-03-17 17:52                           ` Jeff Layton [this message]
2010-03-17 17:58                             ` Trond Myklebust
     [not found]                               ` <1268848682.8335.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-17 18:08                                 ` Jeff Layton
2010-03-17 18:08                                   ` Jeff Layton
2010-01-25 22:15   ` [PATCH 12/12] NFS: Remove requirement for inode->i_mutex from nfs_invalidate_mapping Trond Myklebust
2010-01-25 22:15     ` Trond Myklebust
2010-01-25 22:15 ` [PATCH 11/12] NFS: Clean up nfs_sync_mapping Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100317135205.58731824@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=arjan@infradead.org \
    --cc=fengguang.wu@intel.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=hooanon05@yahoo.co.jp \
    --cc=jack@suse.cz \
    --cc=jens.axboe@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sar@nec-labs.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.