From patchwork Thu Nov 4 20:59:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 302812 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 oA4KtXg4030867 for ; Thu, 4 Nov 2010 20:55:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753117Ab0KDUzc (ORCPT ); Thu, 4 Nov 2010 16:55:32 -0400 Received: from cobra.newdream.net ([66.33.216.30]:40036 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849Ab0KDUzb (ORCPT ); Thu, 4 Nov 2010 16:55:31 -0400 Received: from cobra.newdream.net (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id 0AE7EBC704; Thu, 4 Nov 2010 13:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hq.newdream.net; h=date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=drama; bh=K3igQJHbKlQGQfCIXZwQCzfR 1rQ=; b=NmIgTSziwJ63DIrbu9GeQ/cKZOY6eeXLqAWJYxpyRTHNsHEbCJCZHyrG I56zUCWtRTN64+XqFenecpgqLfHwZRgzt5nnsIXZ/9m4VcxYc1VBsk68/FUt78FC AGDpKO6CZz8K/gHxtZoE3/IWd3S3ZLiI3oo7Xwlb1prvPqlEiyE= Received: by cobra.newdream.net (Postfix, from userid 1031) id E3385BC717; Thu, 4 Nov 2010 13:59:02 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id D35A6BC704; Thu, 4 Nov 2010 13:59:02 -0700 (PDT) Date: Thu, 4 Nov 2010 13:59:02 -0700 (PDT) From: Sage Weil To: Henry C Chang cc: Leander Yu , ceph-devel@vger.kernel.org Subject: Re: mds getattr locked again In-Reply-To: Message-ID: References: MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@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]); Thu, 04 Nov 2010 20:55:33 +0000 (UTC) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 6e0942f..36cad99 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1430,8 +1430,8 @@ static int try_nonblocking_invalidate(struct inode *inode) invalidating_gen == ci->i_rdcache_gen) { /* success. */ dout("try_nonblocking_invalidate %p success\n", inode); - ci->i_rdcache_gen = 0; - ci->i_rdcache_revoking = 0; + /* save any racing async invalidate some trouble */ + ci->i_rdcache_revoking = ci->i_rdcache_gen - 1; return 0; } dout("try_nonblocking_invalidate %p failed\n", inode); diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 1d6a45b..1ca5226 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1386,11 +1386,8 @@ static void ceph_invalidate_work(struct work_struct *work) spin_lock(&inode->i_lock); dout("invalidate_pages %p gen %d revoking %d\n", inode, ci->i_rdcache_gen, ci->i_rdcache_revoking); - if (ci->i_rdcache_gen == 0 || - ci->i_rdcache_revoking != ci->i_rdcache_gen) { - BUG_ON(ci->i_rdcache_revoking > ci->i_rdcache_gen); + if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { /* nevermind! */ - ci->i_rdcache_revoking = 0; spin_unlock(&inode->i_lock); goto out; } @@ -1400,15 +1397,16 @@ static void ceph_invalidate_work(struct work_struct *work) ceph_invalidate_nondirty_pages(inode->i_mapping); spin_lock(&inode->i_lock); - if (orig_gen == ci->i_rdcache_gen) { + if (orig_gen == ci->i_rdcache_gen && + orig_gen == ci->i_rdcache_revoking) { dout("invalidate_pages %p gen %d successful\n", inode, ci->i_rdcache_gen); - ci->i_rdcache_gen = 0; - ci->i_rdcache_revoking = 0; + ci->i_rdcache_revoking--; check = 1; } else { - dout("invalidate_pages %p gen %d raced, gen now %d\n", - inode, orig_gen, ci->i_rdcache_gen); + dout("invalidate_pages %p gen %d raced, now %d revoking %d\n", + inode, orig_gen, ci->i_rdcache_gen, + ci->i_rdcache_revoking); } spin_unlock(&inode->i_lock); diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 1886294..7f01728 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -293,9 +293,7 @@ struct ceph_inode_info { int i_rd_ref, i_rdcache_ref, i_wr_ref; int i_wrbuffer_ref, i_wrbuffer_ref_head; u32 i_shared_gen; /* increment each time we get FILE_SHARED */ - u32 i_rdcache_gen; /* we increment this each time we get - FILE_CACHE. If it's non-zero, we - _may_ have cached pages. */ + u32 i_rdcache_gen; /* incremented each time we get FILE_CACHE. */ u32 i_rdcache_revoking; /* RDCACHE gen to async invalidate, if any */ struct list_head i_unsafe_writes; /* uncommitted sync writes */