[Devel] [PATCH RHEL7 COMMIT] Revert "fs: use original vfsmount for touch_atime"

Konstantin Khorenko khorenko at virtuozzo.com
Tue Oct 22 16:31:33 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.1.2.vz7.114.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.1.2.vz7.114.8
------>
commit 91d8c3e8a140fd53ae9b0a3840a8cb8a663bd10c
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue Oct 22 16:24:41 2019 +0300

    Revert "fs: use original vfsmount for touch_atime"
    
    This reverts commit c03ccabe433a3cf811477358975e9d0a4bd0c144.
    
    The patch being reverted had been introduced in the scope of
    https://jira.sw.ru/browse/PSBM-51009
    
    Now it's reverted in the scope of
    https://jira.sw.ru/browse/PSBM-78863
    
    because Red Hat had backported 4bacc9c9234c ("overlayfs: Make f_path always
    point to the overlay and f_inode to the underlay") long ago and now
    xfstests should work fine on overlayfs (atime part).
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/file_table.c    |  6 ------
 fs/locks.c         |  5 ++---
 fs/open.c          | 19 ++-----------------
 include/linux/fs.h |  4 +---
 4 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index a8f4cffe2fee..6af525d158d1 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -243,8 +243,6 @@ static void __fput(struct file *file)
 	struct dentry *dentry = file->f_path.dentry;
 	struct vfsmount *mnt = file->f_path.mnt;
 	struct inode *inode = file->f_inode;
-	struct dentry *original_dentry = file->f_original_path.dentry;
-	struct vfsmount *original_mnt = file->f_original_path.mnt;
 
 	might_sleep();
 
@@ -276,14 +274,10 @@ static void __fput(struct file *file)
 		drop_file_write_access(file);
 	file->f_path.dentry = NULL;
 	file->f_path.mnt = NULL;
-	file->f_original_path.dentry = NULL;
-	file->f_original_path.mnt = NULL;
 	file->f_inode = NULL;
 	file_free(file);
 	dput(dentry);
 	mntput(mnt);
-	dput(original_dentry);
-	mntput(original_mnt);
 }
 
 static DEFINE_SPINLOCK(delayed_fput_lock);
diff --git a/fs/locks.c b/fs/locks.c
index cb5a3bc186f3..d1cf9a6d704d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1590,9 +1590,8 @@ static int
 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv)
 {
 	struct file_lock *fl, **before, **my_before = NULL, *lease;
-	struct dentry *dentry = filp->f_original_path.mnt ?
-		filp->f_original_path.dentry: filp->f_path.dentry;
-	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct dentry *dentry = filp->f_path.dentry;
+	struct inode *inode = dentry->d_inode;
 	bool is_deleg = (*flp)->fl_flags & FL_DELEG;
 	int error;
 
diff --git a/fs/open.c b/fs/open.c
index ddff043ac1e2..c67314449385 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -900,17 +900,9 @@ int vfs_open(const struct path *path, struct file *filp,
 {
 	struct inode *inode = path->dentry->d_inode;
 	iop_dentry_open_t dentry_open = get_dentry_open_iop(inode);
-	int do_cleanup = 0;
-	int ret;
-
-	if (!filp->f_original_path.mnt && dentry_open) {
-		filp->f_original_path = *path;
-		path_get(&filp->f_original_path);
-		do_cleanup = 1;
-	}
 
 	if (dentry_open)
-		ret = dentry_open(path->dentry, filp, cred);
+		return dentry_open(path->dentry, filp, cred);
 	else {
 		struct dentry *dentry = d_real(path->dentry, NULL, filp->f_flags, 0);
 
@@ -918,15 +910,8 @@ int vfs_open(const struct path *path, struct file *filp,
 			return PTR_ERR(dentry);
 
 		filp->f_path = *path;
-		ret = do_dentry_open(filp, dentry->d_inode, NULL, cred);
+		return do_dentry_open(filp, dentry->d_inode, NULL, cred);
 	}
-
-	if (ret && do_cleanup) {
-		path_put(&filp->f_original_path);
-		filp->f_original_path.mnt = NULL;
-		filp->f_original_path.dentry = NULL;
-	}
-	return ret;
 }
 EXPORT_SYMBOL(vfs_open);
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2ba9c5176980..0b074aa9d8c6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,7 +1059,6 @@ struct file {
 		struct rcu_head 	fu_rcuhead;
 	} f_u;
 	struct path		f_path;
-	struct path		f_original_path;
 #define f_dentry	f_path.dentry
 	struct inode		*f_inode;	/* cached value */
 	const struct file_operations	*f_op;
@@ -2345,8 +2344,7 @@ extern void touch_atime(struct path *);
 static inline void file_accessed(struct file *file)
 {
 	if (!(file->f_flags & O_NOATIME))
-		touch_atime(file->f_original_path.mnt ?
-			    &file->f_original_path : &file->f_path);
+		touch_atime(&file->f_path);
 }
 
 int sync_inode(struct inode *inode, struct writeback_control *wbc);



More information about the Devel mailing list