Bug 1598341
| Summary: | Error messages"umount.nfs4: remote share not in 'host:dir' format" occur when umount nfs filesystem | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | wanjiankang | ||||
| Component: | util-linux | Assignee: | Karel Zak <kzak> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | qe-baseos-daemons | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 7.5 | CC: | sunguoshuai, xzhou, yoyang | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2021-02-15 07:40:09 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Created attachment 1456688 [details]
script file
I found that the error is caused by the referenced library function.Look up source code from nfs-utils source package, the function umount_main call the library function mnt_context_prepare_umount from the file -libmount/src/context_umount.c of util-linux source code package.
/* read mtab/fstab, evaluate permissions, etc. */
rc = mnt_context_prepare_umount(cxt);
if (rc) {
nfs_error(_("%s: failed to prepare umount: %s\n"),
progname, strerror(-rc));
goto err;
}
When multiple programs call this function concurrently,the cxt->fs->attrs may be NULL,although system have sufficient conditions make cxt->fs->attrs is not NULL.Then I look up code from the directory -libmount of util-linux source code package and find
static int mnt_table_parse_next(struct libmnt_table *tb, FILE *f, struct libmnt_fs *fs,
const char *filename, int *nlines)
{
char buf[BUFSIZ];
char *s;
int rc;
assert(tb);
assert(f);
assert(fs);
/* read the next non-blank non-comment line */
next_line:
do {
if (fgets(buf, sizeof(buf), f) == NULL)
return -EINVAL;
++*nlines;
s = strchr (buf, '\n');
the fuction mnt_table_parse_next use fgets read information from /proc/self/mountinofo,it may be miss some content,although /proc/self/mountinfo have
these content.mnt_table_parse_next will be call many times ,every times only get online content.
So I found the cause of the result.Every program open one file,can generate a file descriptor,the file descriptor have the offset value the program have read position.Multiple program concurrently open the same file,Each process has a separate file descriptor about the file,meanwhile has separate offset vlaue.When the data of before the offset value is deleted,hte data of after the offset value will Move forward.if descriptor offset value has no changed.it will skip data without a visit and read the data below,miss some content,cause an error message to print behind.
Oh, sounds as a strange conclusion :-) The kernel generates mountinfo as one string and then it's exported to the userspace program. I don't think it's updated on the fly when userspace just read the file. You need open/read it again to get an updated version of the file. Anyway, fs->attrs is userspace stuff and it comes from /run/mount/utab where we use flock to protect the file. I'm able to reproduce the problem, so I'll try to debug it locally. Thanks! Well, not sure if I'm right in the previous comment. It really seems like the issue is /proc/self/mountinfo, where in umount(8) we see the mountpoint (by fopen->fgets->fclose), but after fork (and umount.nfs exec) we don't see the line (again fopen, ...) in the mountinfo file. After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened. |
Description of problem: Run the command (mount nfs filesystem and umount it) concurrently,there will be error messages(umount.nfs4: remote share not in 'host:dir' format).But the operating result of command is suceess. Version-Release number of selected component (if applicable): util-linux-2.23.2-52.el7.x86_64.rpm How reproducible: Configure nfs server,it can be mount in some directory of a client. Steps to Reproduce: 1.Running script, operating concurrent mount nfs filesystem and umount it on client The script content is: #/bin/bash for (( i=1;i<101;i++ )) do mkdir -p /tmpfs/mount-press-krb5p/user4-${i}& done for (( i=1;i<101;i++ )) do mount nfs-sve1.example.com:/ext4/nfsnobody-krb5 /tmpfs/mount-press-krb5p/user4-${i} & done wait for (( i=1;i<101;i++ )) do umount /tmpfs/mount-press-krb5p/user4-${i} & done wait Actual results: Client will print error messages: umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format umount.nfs4: remote share not in 'host:dir' format Expected results: No error message printed,and the result of the command is executed correctly. Additional info: