nfs41: add a debug warning if we destroy an unempty layout
authorPeng Tao <tao.peng@primarydata.com>
Fri, 10 Oct 2014 15:25:46 +0000 (23:25 +0800)
committerTom Haynes <loghyr@primarydata.com>
Tue, 3 Feb 2015 19:06:47 +0000 (11:06 -0800)
So that we can detect the case if some layout segments are still
pinned which is surely a bug that we need to fix.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
fs/nfs/pnfs.c

index 5f7c422ebb5dc8645d80020479b80069d5c6b669..e123cfce54ee621fec0a4b466cf0f455658a3dc0 100644 (file)
@@ -242,6 +242,8 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo)
        struct inode *inode = lo->plh_inode;
 
        if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) {
+               if (!list_empty(&lo->plh_segs))
+                       WARN_ONCE(1, "NFS: BUG unfreed layout segments.\n");
                pnfs_detach_layout_hdr(lo);
                spin_unlock(&inode->i_lock);
                pnfs_free_layout_hdr(lo);