Bug 452944

Summary: fsck.xfs script is wrong?
Product: [Fedora] Fedora Reporter: GV <rhel>
Component: xfsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-06-26 14:30:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description GV 2008-06-26 07:40:02 UTC
Description of problem:

Up to fedora 8 I had something like this in fstab:
/dev/sdf2               /media/h-drive         xfs    
defaults,users,noauto,exec,nodev,nosuid 1 2

Then fsck was running from rc.sysconfig, there was no problems. 

Now, in Fedora 9, fsck.xfs script has a new test:

if [ ! -e $DEV ]; then
      echo "$0: $DEV does not exist"
      exit 8
fi

which make fsck to fail and rc.sysconfig ask me to repair the file system.

Version-Release number of selected component (if applicable):
xfsprogs-2.9.7-1.fc9.x86_64

How reproducible:


Steps to Reproduce:
1. add the above line to fstab
2. reboot
  
Actual results:
fsck exit with errrot code 8 and rc.sysconfig ask to repair the filesystem

Expected results:
fsck should not fail.


Additional info:

Comment 1 GV 2008-06-26 07:48:16 UTC
I think script should be like this:

#!/bin/sh -f
#
# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
#

AUTO=false
while getopts ":aAy" c
do
        case $c in
        a|A|y)  AUTO=true;;
        esac
done
if $AUTO; then
        echo "$0: XFS file system."
else
        eval DEV=\${$#}
        if [ ! -e $DEV ]; then
                echo "$0: $DEV does not exist"
                exit 8
        fi
        echo "If you wish to check the consistency of an XFS filesystem or"
        echo "repair a damaged filesystem, see xfs_check(8) and xfs_repair(8)."
fi
exit 0


Comment 2 Eric Sandeen 2008-06-26 13:14:13 UTC
Is /dev/sdf a removable drive, and is it present at boot time?  It seems strange
that fsck would be called for a device which doesn't exist?

Comment 3 GV 2008-06-26 13:42:53 UTC
No. the device is not present. That's the point. If device is present there are
no errors.

And, no. It's not strange at all. Default behavior of /sbin/fsck -A from man
(run bye rc.sysconfig):

       -A     Walk through the /etc/fstab file and try to check all file  sys-
              tems in one run.  This option is typically used from the /etc/rc
              system initialization file, instead  of  multiple  commands  for
              checking a single file system.

In xfsprogs which work OK is xfsprogs-2.9.4-4 from Fedora 8.
xfsprogs-2.9.7 (fedora 9) have the fsck.xfs script modified. And the
modifications are not working as expected.


Gabriel


Comment 4 Eric Sandeen 2008-06-26 14:19:10 UTC
I'll ask the sgi guys why the check was put in there.  Maybe it is just the
wrong error code returned.  If fsck is asked to check a device that does not
exist, I assume that it should not just return success, but I'll double-check
(looking at what e2fsck does, now)

I'm not saying that today's behavior is proper, and I agree that it needs to be
fixed, just thinking out loud about what's going on, and the proper way to fix it.

Thanks,

-Eric

Comment 5 Eric Sandeen 2008-06-26 14:30:19 UTC
FWIW:

[root@neon ~]# e2fsck /dev/sdzz
e2fsck 1.40.4 (31-Dec-2007)
e2fsck: No such file or directory while trying to open /dev/sdzz
...
[root@neon ~]# echo $?
8

This actually appears to be proper behavior, you'd see the same thing with
e2fsprogs (even in F8 and earlier) if you had ext3 on the drive.

Talking w/ notting (keeper of the initscripts) he points out that "noauto +
autofsck doesn't really make sense" and really you cannot reliably ask for
autofsck of removable media at boot time.

While it would be nice, I do not think there is any mechanism to say "fsck and
mount this device if it is available, otherwise continue"

I think your best bet is to just end the fstab line with "0 0" so that it does
not check at boot time (and fsck.xfs does not do anything anyway, so you're not
losing any safety).

I'm going to NOTABUG this, really I think you just got "lucky" in F8 because
fsck.xfs was (improperly) not returning any error when the requested device was
missing.

Thanks,

-Eric


Comment 6 GV 2008-06-26 17:55:36 UTC
(In reply to comment #5)
> This actually appears to be proper behavior, you'd see the same thing with
> e2fsprogs (even in F8 and earlier) if you had ext3 on the drive.
You're right.

> While it would be nice, I do not think there is any mechanism to say "fsck and
> mount this device if it is available, otherwise continue"
Well, a small  script can do this.

> I think your best bet is to just end the fstab line with "0 0" so that it does
> not check at boot time
Right again.

> (and fsck.xfs does not do anything anyway, so you're not
> losing any safety).
Yes, I know that.

> I'm going to NOTABUG this, really I think you just got "lucky" in F8 because
> fsck.xfs was (improperly) not returning any error when the requested device
> was missing.
OK.
But it's not only in Fedora 8. I use that line from fstab in RedHat 9, Fedora 1
to 8 (yes, I still use RH9 :-) ).


Thank you.

Sincerely,
Gabriel



Comment 7 Eric Sandeen 2008-06-26 18:03:33 UTC
> But it's not only in Fedora 8. I use that line from fstab in RedHat 9, Fedora 1
> to 8 (yes, I still use RH9 :-) ).

And using xfs since all that time, I'm impressed!  :)