From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 08/10] exportfs: use dget_parent Date: Sun, 10 Oct 2010 05:36:28 -0400 Message-ID: <20101010093722.191712956@canuck.infradead.org> References: <20101010093620.416498597@canuck.infradead.org> Cc: eparis@redhat.com, linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk Return-path: Received: from canuck.infradead.org ([134.117.69.58]:40679 "EHLO canuck.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754279Ab0JJJhe (ORCPT ); Sun, 10 Oct 2010 05:37:34 -0400 Content-Disposition: inline; filename=exportfs-use-dget_parent Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Use dget_parent instead of opencoding it. This simplifies the code, but more importanly prepares for the more complicated locking for a parent dget in the dcache scale patch series. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/exportfs/expfs.c =================================================================== --- linux-2.6.orig/fs/exportfs/expfs.c 2010-10-10 09:51:24.580004056 +0200 +++ linux-2.6/fs/exportfs/expfs.c 2010-10-10 09:52:34.490016907 +0200 @@ -74,21 +74,20 @@ static struct dentry * find_disconnected_root(struct dentry *dentry) { dget(dentry); - spin_lock(&dentry->d_lock); - while (!IS_ROOT(dentry) && - (dentry->d_parent->d_flags & DCACHE_DISCONNECTED)) { - struct dentry *parent = dentry->d_parent; - dget(parent); - spin_unlock(&dentry->d_lock); + while (!IS_ROOT(dentry)) { + struct dentry *parent = dget_parent(dentry); + + if (parent->d_flags & DCACHE_DISCONNECTED) { + dput(parent); + break; + } + dput(dentry); dentry = parent; - spin_lock(&dentry->d_lock); } - spin_unlock(&dentry->d_lock); return dentry; } - /* * Make sure target_dir is fully connected to the dentry tree. *