[Devel] [PATCH RHEL7 COMMIT] ms/fs: __dentry_path() fixes

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 18 06:00:05 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.14
------>
commit dc9d3da449d7958ffac23d67f27ebdc21c991c51
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu Jun 18 17:00:05 2015 +0400

    ms/fs: __dentry_path() fixes
    
    Patchset description:
    
    port fixes from mainstream to fix fails from getcwd04 test,
    now it pass:
    
      ./third/ltp/testcases/kernel/syscalls/getcwd/getcwd04
      getcwd04    1  TPASS  :  Bug is not reproduced!
    
    https://jira.sw.ru/browse/PSBM-34245
    
    Al Viro (2):
      prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts
      __dentry_path() fixes
    
    Eric W. Biederman (1):
      vfs: Remove second variable named error in __dentry_path
    
    Pavel Tikhomirov (1):
      dcache: reinitialize error for resetart in prepend_path as in ms
    
    ##################################################################
    This patch description:
    
    From: Al Viro <viro at zeniv.linux.org.uk>
    
    Port mainstream commit:
    
      commit f6500801522c61782d4990fa1ad96154cb397cd4
      Author: Al Viro <viro at zeniv.linux.org.uk>
      Date:   Sun Jan 26 12:37:55 2014 -0500
    
          __dentry_path() fixes
    
          * we need to save the starting point for restarts
          * reject pathologically short buffers outright
    
          Spotted-by: Denys Vlasenko <dvlasenk at redhat.com>
          Spotted-by: Oleg Nesterov <oleg at redhat.com>
          Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov at parallels.com>
---
 fs/dcache.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index ecbfb07..ad4acc4 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3099,19 +3099,22 @@ char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
 /*
  * Write full pathname from the root of the filesystem into the buffer.
  */
-static char *__dentry_path(struct dentry *dentry, char *buf, int buflen)
+static char *__dentry_path(struct dentry *d, char *buf, int buflen)
 {
+	struct dentry *dentry;
 	char *end, *retval;
 	int len, seq = 0;
 	int error = 0;
 
+	if (buflen < 2)
+		goto Elong;
+
 	rcu_read_lock();
 restart:
+	dentry = d;
 	end = buf + buflen;
 	len = buflen;
 	prepend(&end, &len, "\0", 1);
-	if (buflen < 1)
-		goto Elong;
 	/* Get '/' right */
 	retval = end-1;
 	*retval = '/';



More information about the Devel mailing list