-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Niki Denev wrote: > Niki Denev wrote: >> Niki Denev wrote: >>> Wilkinson, Alex wrote: >>>> 0n Wed, Jun 06, 2007 at 06:45:26PM +0300, Niki Denev wrote: >>>> > I have the following problem when using gjournal for the root filesystem on my laptop (Sony VAIO PCG-U3) >>>> > If there is a unclean shutdown (hard poweroff/ kernel panic) on the next boot the machine starts to load normally, >>>> > i have messages as : >>>> > >>>> > GEOM_JOURNAL: Journal ad0s1a consistent. >>>> > Trying to mount root from ufs:/dev/ad0s1a.journal >>>> > WARNING: / was not properly dismounted >>>> > >>>> > Then the system continues with executing fsck in preen mode (fsck -p), >>>> > which reports : >>>> > /dev/ad0s1a.journal: FILESYSTEM CLEAN; SKIPPING CHECKS >>>> > and fsck returns with zero, but after this when a read/write mount is tried the >>>> > system barfs this : >>>> > >>>> > WARNING: R/W mount of / denied. Filesystem not clean - run fsck. >>>> > mount: : Operation not permitted >>>> Make sure your "Pass" column is correct in fstab(5). >>>> -aW >>>> IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914. If you have received this email in error, you are requested to contact the sender and delete the email. > >>> What do you mean by correct? Right now it's the default for root >>> filesystems "1". Is there a special setting needed for gjournaled >>> filesystems? > > >> Well, i still can't find a way to make my system skip fsck on unclean >> shutdown/reboot. >> The strange thing is that "fsck -p" reports that the filesystem is >> clean, but the kernel refuses to mount it r/w with the message "WARNING: >> R/W mount of / denied. Filesystem is not clean - run fsck" > >> I guess i'm doing something wrong.. just can't see what it is.. any >> ideas are appreciated. > >> Thanks. > > > > I think that i tracked down the problem. > When fsck_ffs runs on dirty gjournaled filesystem in preen mode, it > checks it correctly, and marks it clean but exits too soon and does not > call mount with MNT_RELOAD so the superblock is not being reread from > the disk and the kernel still thinks that the filesystem is dirty, > alshough on-disk it has been marked clean. > My quick and dirty hack was instead of just calling exit(0) in > src/sbin/fsck_ffs/main.c::checkfilesys() after the call to > gjournal_check(), i do a nasty goto to the end of the function where > there is additional code which checks if the filesystem is mounted, and > if it is, then it tries to reload the superblock and the other disk/fs > data. Ideally this could be done better :) I'll try to come up with > something and file a PR if someone doesn't read this and make a better fix. I submitted PR misc/113889 for this issue, with attached the following patch, which fixes the problem for my machines which are using gjournal as root fs. - --- src/sbin/fsck_ffs/main.c.orig Wed Jun 20 22:55:58 2007 +++ src/sbin/fsck_ffs/main.c Wed Jun 20 23:42:03 2007 _at__at_ -67,6 +67,7 _at__at_ static void usage(void) __dead2; static int argtoi(int flag, const char *req, const char *str, int base); static int checkfilesys(char *filesys); +static int chkdoreload(struct statfs *mntp); static struct statfs *getmntpt(const char *); int _at__at_ -253,7 +254,10 _at__at_ } if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) { gjournal_check(filesys); - - exit(0); + ret = chkdoreload(mntp); + if (ret == 0) + exit(0); + exit(4); } else { pfatal("UNEXPECTED INCONSISTENCY, %s\n", "CANNOT RUN FAST FSCK\n"); _at__at_ -483,29 +487,45 _at__at_ printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); if (rerun) printf("\n***** PLEASE RERUN FSCK *****\n"); - - if (mntp != NULL) { - - /* - - * We modified a mounted file system. Do a mount update on - - * it unless it is read-write, so we can continue using it - - * as safely as possible. - - */ - - if (mntp->f_flags & MNT_RDONLY) { - - args.fspec = 0; - - args.export.ex_flags = 0; - - args.export.ex_root = 0; - - ret = mount("ufs", mntp->f_mntonname, - - mntp->f_flags | MNT_UPDATE | MNT_RELOAD, &args); - - if (ret == 0) - - return (0); - - pwarn("mount reload of '%s' failed: %s\n\n", - - mntp->f_mntonname, strerror(errno)); - - } + ret = chkdoreload(mntp); + if (ret) { if (!fsmodified) return (0); if (!preen) printf("\n***** REBOOT NOW *****\n"); sync(); return (4); + } + return (0); +} + +static int +chkdoreload(struct statfs *mntp) +{ + struct ufs_args args; + int ret; + + if (mntp == NULL) + return (0); + /* + * We modified a mounted file system. Do a mount update on + * it unless it is read-write, so we can continue using it + * as safely as possible. + */ + if (mntp->f_flags & MNT_RDONLY) { + memset(&args, 0, sizeof args); + /* + * args.fspec = 0; + * args.export.ex_flags = 0; + * args.export.ex_root = 0; + */ + ret = mount("ufs", mntp->f_mntonname, + mntp->f_flags | MNT_UPDATE | MNT_RELOAD, &args); + if (ret == 0) + return (0); + pwarn("mount reload of '%s' failed: %s\n\n", + mntp->f_mntonname, strerror(errno)); + return (1); } return (0); } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGeZh6HNAJ/fLbfrkRAlEzAJ9JzKSVgdCBcP5cHOAmjh6Fh90HKQCgyakr wfa2W1yHOnidyc63iJfisks= =F1kH -----END PGP SIGNATURE-----Received on Wed Jun 20 2007 - 19:13:33 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC