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.
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?
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.
Responsible Changed From-To: freebsd-bugs->brucec Take.
Responsible Changed From-To: brucec->freebsd-bugs Back to the pool due to lack of time.
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
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)?
Created attachment 238557 [details] proposed fix
(In reply to Xin LI from comment #6) I have attached a proposed fix along the lines that you suggest.
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(-)
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(-)
Change has been MFC'ed to 13.