Bug 19683 - mount(8) displays incorrect mount point on failed mount
Summary: mount(8) displays incorrect mount point on failed mount
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 5.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Kirk McKusick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-07-04 01:20 UTC by davidn
Modified: 2022-12-14 23:39 UTC (History)
1 user (show)

See Also:


Attachments
proposed fix (2.77 KB, patch)
2022-12-05 22:16 UTC, Kirk McKusick
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description davidn 2000-07-04 01:20:01 UTC
	mount(8) displays the previously used mount point if a
	mount operation fails instead of the mount point that
	it is actually attempting to use.

How-To-Repeat: 
	Mount a partition on /mnt which would normally be mounted
	elsewhere. Shutdown the system leaving the partition in
	an unclean state. On next boot, when attempting to remount
	the partition/drive, mount(8) displays:

WARNING: R/W mount of /mnt denied. Filesystem is not clean - run fsck

	where /mnt is the previous mount point, not the one in
	/etc/fstab which mount is actually trying to use.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-05 10:19:56 UTC
Responsible Changed
From-To: freebsd-bugs->green

Brian is the committer who touches mount the most.  Brian, could 
you perhaps get into contact with Martin Blapp over this one 
and then bring in any patches he may present?
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2007-07-31 07:02:02 UTC
Responsible Changed
From-To: green->freebsd-ports-bugs

This was assigned to green@ by someone else, and he has been inactive, 
so reset assignment with hat: bugmeister.
Comment 3 Bruce Cran freebsd_committer freebsd_triage 2010-06-21 22:11:49 UTC
Responsible Changed
From-To: freebsd-bugs->brucec

Take.
Comment 4 Bruce Cran freebsd_committer freebsd_triage 2011-01-23 21:35:57 UTC
Responsible Changed
From-To: brucec->freebsd-bugs

Back to the pool due to lack of time.
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:28 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 6 Xin LI freebsd_committer freebsd_triage 2022-12-05 00:10:17 UTC
I think this can be solved by replacing fs->fs_fsmnt with mp->mnt_stat.f_mntonname (the code was introduced in 1469eec81e4a8c70124118a552ab06620332a6bd / r8530 in 1995)?
Comment 7 Kirk McKusick freebsd_committer freebsd_triage 2022-12-05 22:16:44 UTC
Created attachment 238557 [details]
proposed fix
Comment 8 Kirk McKusick freebsd_committer freebsd_triage 2022-12-05 22:17:32 UTC
(In reply to Xin LI from comment #6)
I have attached a proposed fix along the lines that you suggest.
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-12-05 22:51:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=08e5f519b21dfcc7543c41c14d066b2d015fbf5c

commit 08e5f519b21dfcc7543c41c14d066b2d015fbf5c
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-12-05 22:47:24 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-12-05 22:50:42 +0000

    Provide more precise mount(8) failure message.

    Suggested by: Xin LI
    Reviewed by:  kib
    PR:           19683
    MFC after:    1 week

 sys/ufs/ffs/ffs_vfsops.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-12-14 23:35:26 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=09d7e0d710609f2650094b2aabee405aa64857cd

commit 09d7e0d710609f2650094b2aabee405aa64857cd
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-12-05 22:47:24 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-12-14 23:34:50 +0000

    Provide more precise mount(8) failure message.

    PR:           19683

    (cherry picked from commit 08e5f519b21dfcc7543c41c14d066b2d015fbf5c)

 sys/ufs/ffs/ffs_vfsops.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
Comment 11 Kirk McKusick freebsd_committer freebsd_triage 2022-12-14 23:39:17 UTC
Change has been MFC'ed to 13.