Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755159AbcCWOGo (ORCPT ); Wed, 23 Mar 2016 10:06:44 -0400 Received: from mail-lb0-f196.google.com ([209.85.217.196]:33077 "EHLO mail-lb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbcCWOGm (ORCPT ); Wed, 23 Mar 2016 10:06:42 -0400 MIME-Version: 1.0 In-Reply-To: <20160323133606.GF11906@tucsk> References: <20160323133606.GF11906@tucsk> From: William Dauchy Date: Wed, 23 Mar 2016 15:06:20 +0100 Message-ID: Subject: Re: [PATCH v2] fs: add file_dentry() To: Miklos Szeredi Cc: Al Viro , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , linux-unionfs@vger.kernel.org, David Howells , Goldwyn Rodrigues , Trond Myklebust , "Theodore Ts'o" , Daniel Axtens , stable Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1568 Lines: 39 Hello Miklos, On Wed, Mar 23, 2016 at 2:36 PM, Miklos Szeredi wrote: > This series fixes bugs in nfs and ext4 due to 4bacc9c9234c ("overlayfs: > Make f_path always point to the overlay and f_inode to the underlay"). > > Regular files opened on overlayfs will result in the file being opened on > the underlying filesystem, while f_path points to the overlayfs > mount/dentry. > > This confuses filesystems which get the dentry from struct file and assume > it's theirs. > > Add a new helper, file_dentry() [*], to get the filesystem's own dentry > from the file. This checks file->f_path.dentry->d_flags against > DCACHE_OP_REAL, and returns file->f_path.dentry if DCACHE_OP_REAL is not > set (this is the common, non-overlayfs case). > > In the uncommon case it will call into overlayfs's ->d_real() to get the > underlying dentry, matching file_inode(file). > > The reason we need to check against the inode is that if the file is copied > up while being open, d_real() would return the upper dentry, while the open > file comes from the lower dentry. > > [*] If possible, it's better simply to use file_inode() instead. > > Signed-off-by: Miklos Szeredi > Tested-by: Goldwyn Rodrigues > Reviewed-by: Trond Myklebust > Cc: # v4.2 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay"). This commit is from v4.1 if I am not wrong. So the stable tag might be wrong. Am I missing something? -- William