[LU-14366] "lfs mkdir" on existing directory returns "Operation not supported/already in progress" Created: 26/Jan/21  Updated: 23/Feb/22  Resolved: 15/Apr/21

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

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: Lai Siyao
Resolution: Fixed Votes: 0
Labels: dne3

Issue Links:
Related
is related to LU-14210 DNE3: "lfs migrate -m" should allow-n... Resolved
is related to LU-15589 interop sanity test_230s: lfs mkdir d... Resolved
is related to LU-14975 DNE3: directory migration in non-recu... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Running "[{lfs mkdir /path/to/existing/directory}}" prints an error message "Operation not permitted" (-EPERM) for a directory that already exists, rather than the more expected "File already exists" (-EEXIST).

It turns out that this is because "lfs mkdir" will now restriping a directory in the background, if it already exists, to match the new layout given by "lfs mkdir". This fails with "Operation not permitted" if mdt.*.enable_dir_restripe=0.

If "mdt.*.enable_dir_restripe=1" then the background restripe fails with "Operation already in progress" (-EALREADY).

I think it is confusing from a user perspective if "lfs mkdir" is trying to migrate the directory when it already exists. This is happening because "lfs mkdir" is internally just an alias for "lfs setdirstripe", but I still think it is confusing, and wonder if we need to treat these commands slightly differently in this case (e.g. add a flag to "lfs mkdir" to prevent it from doing the silent migration? It should return -EEXIST in that case.

My understanding is that the difference between "lfs setdirstripe" and "lfs migrate -m" is that setdirstripe will only move the entries to the new MDT(s), while "migrate -m" will also move the inodes to the new MDT(s)? I definitely like the idea of being able to restripe a directory and only move the entries, but I wonder if the entry-only restripe would be more clear if it was an option for "lfs migrate -m"?



 Comments   
Comment by Lai Siyao [ 26/Jan/21 ]

I'll add a flag for this later.

The main difference between 'lfs setdirstripe' and 'lfs migrate -m' is: for directory restripe, the existing master object and shards will be kept(If it's a plain directory, the original directory object will become the first shard), while 'lfs migrate -m' will always create new master object and shards.

Once "mdt.*.dir_restripe_nsonly" is set to "0", directory restripe will move inodes too.

Comment by Gerrit Updater [ 15/Apr/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/41329/
Subject: LU-14366 mdt: lfs mkdir should return -EEXIST if exists
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 65e3e4050ec5bb371c1c343fca49a605286a086e

Comment by Peter Jones [ 15/Apr/21 ]

Landed for 2.15

Generated at Sat Feb 10 03:09:06 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.