diff options
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 4712c943cdf7..4aeccb13437b 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -2271,6 +2271,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; |