]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/stat.c
Merge tag 'pm-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[thirdparty/linux.git] / fs / stat.c
index 030008796479aa135964995e4fe8a1fad91ede37..b9faa6cafafedb19f86d2f0e0f69eaa4f496bb24 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -22,6 +22,7 @@
 #include <asm/unistd.h>
 
 #include "internal.h"
+#include "mount.h"
 
 /**
  * generic_fillattr - Fill in the basic attributes from the inode struct
@@ -70,11 +71,11 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
 
        memset(stat, 0, sizeof(*stat));
        stat->result_mask |= STATX_BASIC_STATS;
-       request_mask &= STATX_ALL;
        query_flags &= KSTAT_QUERY_FLAGS;
 
        /* allow the fs to override these if it really wants to */
-       if (IS_NOATIME(inode))
+       /* SB_NOATIME means filesystem supplies dummy atime value */
+       if (inode->i_sb->s_flags & SB_NOATIME)
                stat->result_mask &= ~STATX_ATIME;
        if (IS_AUTOMOUNT(inode))
                stat->attributes |= STATX_ATTR_AUTOMOUNT;
@@ -199,6 +200,11 @@ retry:
                goto out;
 
        error = vfs_getattr(&path, stat, request_mask, flags);
+       stat->mnt_id = real_mount(path.mnt)->mnt_id;
+       stat->result_mask |= STATX_MNT_ID;
+       if (path.mnt->mnt_root == path.dentry)
+               stat->attributes |= STATX_ATTR_MOUNT_ROOT;
+       stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT;
        path_put(&path);
        if (retry_estale(error, lookup_flags)) {
                lookup_flags |= LOOKUP_REVAL;
@@ -563,6 +569,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
        tmp.stx_rdev_minor = MINOR(stat->rdev);
        tmp.stx_dev_major = MAJOR(stat->dev);
        tmp.stx_dev_minor = MINOR(stat->dev);
+       tmp.stx_mnt_id = stat->mnt_id;
 
        return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }