lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <F5370214-6FE9-475F-A4EF-60A477A733B4@redhat.com>
Date:   Mon, 21 May 2018 21:04:23 +0800
From:   "Yan, Zheng" <zyan@...hat.com>
To:     Luis Henriques <lhenriques@...e.com>
Cc:     Sage Weil <sage@...hat.com>, Ilya Dryomov <idryomov@...il.com>,
        Ceph Development <ceph-devel@...r.kernel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ceph: fix st_nlink stat for directories



> On May 21, 2018, at 17:27, Luis Henriques <lhenriques@...e.com> wrote:
> 
> Currently, calling stat on a cephfs directory returns 1 for st_nlink.
> This behaviour has recently changed in the fuse client, as some
> applications seem to expect this value to be either 0 (if it's
> unlinked) or 2 + number of subdirectories.  This behaviour was changed
> in the fuse client with commit 67c7e4619188 ("client: use common
> interp of st_nlink for dirs").
> 
> This patch modifies the kernel client to have a similar behaviour.
> 
> Link: https://tracker.ceph.com/issues/23873
> Signed-off-by: Luis Henriques <lhenriques@...e.com>
> ---
> fs/ceph/inode.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index aa7c5a4ff137..6ad66ef8fd66 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2288,6 +2288,14 @@ int ceph_getattr(const struct path *path, struct kstat *stat,
> 				stat->size = ci->i_files + ci->i_subdirs;
> 			stat->blocks = 0;
> 			stat->blksize = 65536;
> +			/*
> +			 * Some applications rely on the number of st_nlink
> +			 * value on directories to be either 0 (if unlinked)
> +			 * or 2 + number of subdirectories.
> +			 */
> +			if (stat->nlink == 1)
> +				/* '.' + '..' + subdirs */
> +				stat->nlink = 1 + 1 + ci->i_subdirs;
> 		}
> 	}
> 	return err;

Applied, thanks.

Yan, Zheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ