From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Mon, 8 Dec 2014 12:38:22 +0000 Subject: [Cluster-devel] [PATCH 14/15] GFS2: gfs2_dir_get_hash_table(): avoiding deferred vfree() is easy here... In-Reply-To: <1418042303-1536-1-git-send-email-swhiteho@redhat.com> References: <1418042303-1536-1-git-send-email-swhiteho@redhat.com> Message-ID: <1418042303-1536-15-git-send-email-swhiteho@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: Al Viro vfree() is allowed under spinlock these days, but it's cheaper when it doesn't step into deferred case and here it's very easy to avoid. Signed-off-by: Al Viro Signed-off-by: Steven Whitehouse diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index c247fed..c5a34f0 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -370,11 +370,12 @@ static __be64 *gfs2_dir_get_hash_table(struct gfs2_inode *ip) } spin_lock(&inode->i_lock); - if (ip->i_hash_cache) - kvfree(hc); - else + if (likely(!ip->i_hash_cache)) { ip->i_hash_cache = hc; + hc = NULL; + } spin_unlock(&inode->i_lock); + kvfree(hc); return ip->i_hash_cache; } -- 1.8.3.1