[LU-1553] inaccessible files in .lustre Created: 21/Jun/12  Updated: 18/Apr/13  Resolved: 18/Apr/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.3.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: fid
Environment:
  1. cat /proc/fs/lustre/version
    lustre: 2.2.57
    kernel: patchless_client
    build: 2.2.57-ge827449-CHANGED-2.6.32-220.23.1.el6.l2.2.55

Issue Links:
Related
is related to LU-1518 Missing/bad operations in mdd_{obf,do... Resolved
Severity: 3
Rank (Obsolete): 6376

 Description   

root can create files in the .lustre directory which are inaccessible. The definition of mdo_create() is such that the function called belongs to the child not the parent:

static inline int mdo_create(env, p, lchild_name, c, spc, at)
{
        LASSERT(c->mo_dir_ops->mdo_create);
        return c->mo_dir_ops->mdo_create(env, p, lchild_name, c, spc, at);
}

This means that dot_lustre_mdd_object_create() can never be called to prevent creation in .lustre. (Some of the other wrappers, including mdo_unlink(), are also defined way.)

[root]# sys_stat -x .lustre
dev              2c54f966
ino                  61ac
mode                 41ed
nlink                   2
uid                     0
gid                     0
rdev                    0
size                 1000
blksize              1000
blocks                  8
atime            4fe386ed
mtime            4fe386ed
ctime            4fe386ed
[root]# sys_getdents -x .lustre
d  200000002000001 `.'
d             61ab `..'
[root]# sys_creat .lustre/RABBIT
[root]# sys_getdents -x .lustre
r  200000400000001 `RABBIT'
d  200000002000001 `.'
d             61ab `..'

Since lookup is special for .lustre, these objects cannot be accessed once created.

[root]# sys_stat -x .lustre/RABBIT
cannot stat `.lustre/RABBIT': No such file or directory
[root]# sys_open .lustre/RABBIT r
cannot open `.lustre/RABBIT' with flags 0, mode 0666: No such file or directory

As with LU-1550, if the .lustre directory is accessed by FID, then it behaves differently.

[root]# sys_stat -x .lustre/fid/[0x200000002:0x1:0x0]/RABBIT
dev              2c54f966
ino       200000400000001
mode                 81a4
nlink                   1
uid                     0
gid                     0
rdev                    0
size                    0
blksize            200000
blocks                  0
atime            4fe38760
mtime            4fe38760
ctime            4fe38760
[root]# sys_open .lustre/fid/[0x200000002:0x1:0x0]/RABBIT r
[root]# sys_unlink .lustre/fid/[0x200000002:0x1:0x0]/RABBIT
[root]# sys_getdents -x .lustre/fid/[0x200000002:0x1:0x0]
d  200000002000001 `.'
d             61ab `..'
[root]# sys_getdents -x .lustre
r  200000400000001 `RABBIT'
d  200000002000001 `.'
d             61ab `..'

Note that path2fid on .lustre does not return LU_DOT_LUSTRE_FID, and hence that the md_object created in create_dot_lustre_dir() and the dt_object() accessed in mdd_dot_lustre_setup() are connected only by their backing inode:

root]# lfs path2fid .lustre
[0x61ac:0x2e5cf44d:0x0]
[root]# sys_stat -x .lustre/fid
dev              2c54f966
ino       200000002000002
mode                 41ed
nlink                   2
uid                     0
gid                     0
rdev                    0
size                 1000
blksize              1000
blocks                  8
atime            4fe387b3
mtime            4fe38760
ctime            4fe38760
[root]# sys_stat -x .lustre/fid/[0x200000002:0x1:0x0]/fid
cannot stat `.lustre/fid/[0x200000002:0x1:0x0]/fid': No such file or directory


 Comments   
Comment by Andreas Dilger [ 21/Jun/12 ]

Users shouldn't be allowed to create files in the .lustre directory. This is intended for files with "special meanings" (snapshots, etc).

Comment by Andreas Dilger [ 05/Jul/12 ]

These bugs are symptoms that internal files should not be accessible through .lustre.

Comment by Richard Henwood (Inactive) [ 12/Nov/12 ]

On current master, I could not create complete the sys_creat within .lustre/

[root@lmaster-124 lustre]# sys_stat -x .lustre
dev              2c54f966
ino                  c37a
mode                 41ed
nlink                   2
uid                     0
gid                     0
rdev                    0
size                 1000
blksize              1000
blocks                  8
atime            50a12bab
mtime            50a12bab
ctime            50a12bab
[root@lmaster-124 lustre]# sys_getdents -x .lustre
d  200000002000001 `.'
d             c378 `..'
[root@lmaster-124 lustre]# sys_creat .lustre/RABBIT
sys_creat: cannot create `.lustre/RABBIT' with mode 0666: Operation not permitted
[root@lmaster-124 lustre]# sys_getdents -x .lustre
d  200000002000001 `.'
d             c378 `..'
[root@lmaster-124 lustre]#

Assuming this issue has been resolved by the resolution of LU-1518.

Generated at Sat Feb 10 01:17:39 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.