From patchwork Sun May 22 02:56:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 806262 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 p4M2uebh030798 for ; Sun, 22 May 2011 02:56:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753882Ab1EVC4h (ORCPT ); Sat, 21 May 2011 22:56:37 -0400 Received: from daytona.panasas.com ([67.152.220.89]:30545 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753621Ab1EVC4h (ORCPT ); Sat, 21 May 2011 22:56:37 -0400 Received: from fs2.bhalevy.com ([172.17.33.53]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 21 May 2011 22:56:36 -0400 Message-ID: <4DD87B5B.30309@panasas.com> Date: Sun, 22 May 2011 05:56:27 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110430 Remi/fc12 Thunderbird/3.1.10 MIME-Version: 1.0 To: NFS list Subject: [OUT-OF-TREE] DEBUGME: pnfs: DEBUGING of lseg ref counting X-OriginalArrivalTime: 22 May 2011 02:56:36.0586 (UTC) FILETIME=[DD8234A0:01CC182B] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 22 May 2011 02:56:40 +0000 (UTC) With this patch it is possible to find lseg ref counting problems. It might help some one in the future Signed-off-by: Boaz Harrosh --- fs/nfs/pnfs.c | 9 +++++---- fs/nfs/pnfs.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 17d0c4c..8d2baf8 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -239,6 +239,7 @@ init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg) smp_mb(); set_bit(NFS_LSEG_VALID, &lseg->pls_flags); lseg->pls_layout = lo; + printk(KERN_ERR "@@@%s: lseg %p ref 1 valid 1\n", __func__, lseg); } static void free_lseg(struct pnfs_layout_segment *lseg) @@ -266,14 +267,14 @@ put_lseg_common(struct pnfs_layout_segment *lseg) } void -put_lseg(struct pnfs_layout_segment *lseg) +__put_lseg(struct pnfs_layout_segment *lseg, const char* f) { struct inode *inode; if (!lseg) return; - dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg, + dprintk("@@@%s: %s: lseg %p ref %d valid %d\n", __func__, f, lseg, atomic_read(&lseg->pls_refcount), test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); inode = lseg->pls_layout->plh_inode; @@ -286,7 +287,7 @@ put_lseg(struct pnfs_layout_segment *lseg) pnfs_free_lseg_list(&free_me); } } -EXPORT_SYMBOL_GPL(put_lseg); +EXPORT_SYMBOL_GPL(__put_lseg); static inline u64 end_offset(u64 start, u64 len) @@ -367,7 +368,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, * list. It will now be removed when all * outstanding io is finished. */ - dprintk("%s: lseg %p ref %d\n", __func__, lseg, + dprintk("@@@%s: lseg %p ref %d\n", __func__, lseg, atomic_read(&lseg->pls_refcount)); if (atomic_dec_and_test(&lseg->pls_refcount)) { put_lseg_common(lseg); diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 322daba..fa6fe2b 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -166,7 +166,9 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); /* pnfs.c */ void get_layout_hdr(struct pnfs_layout_hdr *lo); -void put_lseg(struct pnfs_layout_segment *lseg); +void __put_lseg(struct pnfs_layout_segment *lseg, const char *f); +#define put_lseg(l) __put_lseg(l, __func__) + struct pnfs_layout_segment * pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, loff_t pos, u64 count, enum pnfs_iomode access_type); @@ -211,14 +213,18 @@ static inline int lo_fail_bit(u32 iomode) } static inline struct pnfs_layout_segment * -get_lseg(struct pnfs_layout_segment *lseg) +__get_lseg(struct pnfs_layout_segment *lseg, const char *f) { if (lseg) { atomic_inc(&lseg->pls_refcount); smp_mb__after_atomic_inc(); + printk(KERN_ERR "@@@%s: %s lseg %p ref %d valid %d\n", __func__, f, lseg, + atomic_read(&lseg->pls_refcount), + test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); } return lseg; } +#define get_lseg(l) __get_lseg(l, __func__) /* Return true if a layout driver is being used for this mountpoint */ static inline int pnfs_enabled_sb(struct nfs_server *nfss)