[LU-15240] some lfs mirror extend error messages start with "lfs mirror mirror" Created: 16/Nov/21  Updated: 06/Dec/21

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: Aleksei Alyaev (Inactive)
Resolution: Unresolved Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Some error messages from "lfs mirror extend" start with "lfs mirror mirror" others start with "error: ". Both should start with "lfs mirror extend: ".

# lfs mirror extend -N -p ddn_ssd f0
lfs mirror mirror: cannot get UNLOCK lease, ext 4: Device or resource busy (16)
error: lfs mirror extend: f0: cannot merge layout: Device or resource busy

The first message should include the file path or at least FID. Paths should be enclosed in single quotes. We should not print two errors for the same message.



 Comments   
Comment by John Hammond [ 16/Nov/21 ]

aalyaev could you take a look at this?

Comment by Aleksei Alyaev (Inactive) [ 16/Nov/21 ]

Sure.

Comment by Aleksei Alyaev (Inactive) [ 24/Nov/21 ]

jhammond there are a few places in lfs.c where a global variable progname gets set to "lfs COMMAND [...]" instead of just "lfs".
 

char cmd[PATH_MAX];
...
snprintf(cmd, sizeof(cmd), "%s %s", progname, argv[0]);
progname = cmd;
...

 
This was introduced in a changeset dating back about 4 years (125f98f, f1daa8f). Looks like it worked for error messages added as part of the changeset, but messed up quite a few other errors in lfs.c where progname was expected to contain only short invocation name.
 
In lfs_mirror() function, the updated progname also overrides the program_invocation_short_name global variable, affecting the error messages from liblustreapi, which relies on command name passed to llapi_set_command_name().
 

snprintf(cmd, sizeof(cmd), "%s %s", progname, argv[0]);
progname = cmd;
program_invocation_short_name = cmd;

 
The first error message came from liblustreapi.c, with program_invocation_short_name set to "lfs mirror", but the command name in llapi set to "mirror", so the source of error got reported as "lfs mirror mirror".
 
The second message came from lfs.c, where progname points to buffer containing "lfs mirror extend", which becomes the error source string.
 
As for including the file path/fid with the error...
 
The second error already contains the file path (not quoted though).
Adding FID/path to the first error message would require a change to liblustreapi.c llapi_lease_set() which only gets a file descriptor.

Comment by John Hammond [ 29/Nov/21 ]

Can you push a patch to make it do the right thing?

Comment by Aleksei Alyaev (Inactive) [ 29/Nov/21 ]

Yes, was already working on it, it's almost ready.

Comment by Aleksei Alyaev (Inactive) [ 06/Dec/21 ]

Hi jhammond,

LU-15240 looks good according to local tests ... all modes report the errors correctly, as far as the source of error is concerned. If you can take a quick look and review the changeset... The errors should change from:

lfs mirror mirror: cannot get UNLOCK lease, ext 4: Device or resource busy (16)
error: lfs mirror extend: f0: cannot merge layout: Device or resource busy

to:

lfs mirror: cannot get UNLOCK lease, ext 4: Device or resource busy (16)
error: lfs mirror extend: f0: cannot merge layout: Device or resource busy

I did not yet enclose the file name in the second message (f0) in single quotes, as the source of error was a more global issue. Let me know if this needs addressing?

Neither did I change the fact that 2 message get printed, as one of them comes from liblustreapi, while the second one is lfs util specific. Doing so would break this pattern in many other places of lfs utility, where errors get reported similarly.

Let me know what else needs to be done here.

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