From patchwork Tue May 24 15:05:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 812492 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 p4OF6IM5022646 for ; Tue, 24 May 2011 15:06:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754623Ab1EXPGR (ORCPT ); Tue, 24 May 2011 11:06:17 -0400 Received: from daytona.panasas.com ([67.152.220.89]:46692 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753272Ab1EXPGR (ORCPT ); Tue, 24 May 2011 11:06:17 -0400 Received: from fs2.bhalevy.com ([172.17.33.70]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 24 May 2011 11:06:16 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list Subject: [PATCH 04/12] pnfs: layout_driver MUST set free_deviceid_node if using dev-cache Date: Tue, 24 May 2011 18:05:46 +0300 Message-Id: <1306249546-23273-1-git-send-email-bharrosh@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4DDBC611.3050202@panasas.com> References: <4DDBC611.3050202@panasas.com> X-OriginalArrivalTime: 24 May 2011 15:06:16.0625 (UTC) FILETIME=[21458210:01CC1A24] 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]); Tue, 24 May 2011 15:06:18 +0000 (UTC) A device cache is not a matter of memory store. It is a matter of mounting/login and unmounting/logout. So it is not logical to not set free_deviceid_node. Who will do the unmount? It is better to crash the developer then let him leak mounts. Signed-off-by: Boaz Harrosh --- fs/nfs/pnfs_dev.c | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index 37ca215..1b592d9 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c @@ -163,10 +163,7 @@ nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *ld, d = nfs4_unhash_put_deviceid(ld, clp, id); if (!d) return; - if (d->ld->free_deviceid_node) - d->ld->free_deviceid_node(d); - else - kfree(d); + d->ld->free_deviceid_node(d); } EXPORT_SYMBOL_GPL(nfs4_delete_deviceid); @@ -232,8 +229,7 @@ nfs4_put_deviceid_node(struct nfs4_deviceid_node *d) hlist_del_init_rcu(&d->node); spin_unlock(&nfs4_deviceid_lock); synchronize_rcu(); - if (d->ld->free_deviceid_node) - d->ld->free_deviceid_node(d); + d->ld->free_deviceid_node(d); return true; } EXPORT_SYMBOL_GPL(nfs4_put_deviceid_node); @@ -258,12 +254,8 @@ _deviceid_purge_client(const struct nfs_client *clp, long hash) synchronize_rcu(); hlist_for_each_entry_safe(d, n, next, &tmp, node) - if (atomic_dec_and_test(&d->ref)) { - if (d->ld->free_deviceid_node) - d->ld->free_deviceid_node(d); - else - kfree(d); - } + if (atomic_dec_and_test(&d->ref)) + d->ld->free_deviceid_node(d); } void