From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] [readdir] Return correct inode number of .. directory Date: Thu, 8 Aug 2013 20:08:01 +0100 Message-ID: <20130808190801.GC27005@ZenIV.linux.org.uk> References: <1375987342-47197-1-git-send-email-ryao@gentoo.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Richard Yao Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:45195 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450Ab3HHTID (ORCPT ); Thu, 8 Aug 2013 15:08:03 -0400 Content-Disposition: inline In-Reply-To: <1375987342-47197-1-git-send-email-ryao@gentoo.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Aug 08, 2013 at 02:42:22PM -0400, Richard Yao wrote: > dir_emit_dotdot() currently passes parent_ino(file->f_path.dentry) to > dir_emit(). Passing a dentry to parent_ino() is wrong. This should have > been parent_ino(file->f_path.dentry->i_ino). What the hell? For the benefit of people who can't be arsed to learn how to use grep, parent_ino() is defined in include/linux/fs.h and that definition is static inline ino_t parent_ino(struct dentry *dentry) { ino_t res; /* * Don't strictly need d_lock here? If the parent ino could change * then surely we'd have a deeper race in the caller? */ spin_lock(&dentry->d_lock); res = dentry->d_parent->d_inode->i_ino; spin_unlock(&dentry->d_lock); return res; } Mind explaining your "passing dentry to parent_ino() is wrong"? What else to pass there? Incidentally, struct dentry has no field called 'i_ino', so with that patch the whole thing won't compile, period. Consider the patch NAKed.