Bug 102211 - XFS filesystem on an offlined drive hangs with the message "metadata I/O error"
Summary: XFS filesystem on an offlined drive hangs with the message "metadata I/O error"
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: XFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: XFS Guru
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-02 07:44 UTC by Paul Osmialowski
Modified: 2016-09-22 16:26 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.18.12
Tree: Mainline
Regression: No


Attachments

Description Paul Osmialowski 2015-08-02 07:44:13 UTC
I've installed XFS on USB HDD. Usually I remember to unmount it safely before I disconnect it. But there were several cases when I forgotten about it. It never caused a problem before as I could mount it again and everything could be repaired at mount time.

Recently I updated kernel to version 4.0.5 on my Gentoo machine. Everything was fine until today. I've forgotten to unmount filesystem when I disconnected my USB HDD. So I connected it again hoping that what I did will be fixed during mount. Unfortunately, mount did not work.
What I found is that drive which was usually /dev/sdf now was reported /dev/sdg. It is certain that /dev/sdf entry was still in use. And indeed in dmesg I've found that kernel is still fighting with suddenly disconnected XFS on /dev/sdf1.

I entered errror message in a google and found that it occured to others too, see RedHat bugzilla ticket with the same error message:

https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=1103792

'sync' command couldn't complete, I couldn't reboot my machine, I couldn't shutdown it gracefully, I could only pull the plug! Dmesg was growing due to XFS metadata error on /dev/sdf1 messages repeated again and again. That wasn't nice, so I don't plan to reproduce it.
Comment 1 Paul Osmialowski 2015-08-02 08:26:10 UTC
This was a raw morning. I did not notice that on this machine kernel wasn't updated yet. It is still 3.18.12. Sorry for misleading statement.
Comment 2 Eric Sandeen 2015-08-03 17:22:29 UTC
It would be good to be more graceful about this, and there are other scenarios where better recovery is needed.  Today, XFS just keeps trying, hoping the device will come back (as it might on a SAN that is having trouble).

In the future, you can do:

# xfs_io -c "shutdown" /dev/sdf1

and it should be unmountable after that.
Comment 3 Eric Sandeen 2016-09-22 16:24:40 UTC
I'm batch-closing all xfs bugs which are more than 1 year old, sorry about that.

If you still have this issue on a current kernel, please retest and re-open with this information.

Thanks,
-Eric
Comment 4 Eric Sandeen 2016-09-22 16:25:41 UTC
192852b xfs: configurable error behavior via sysfs

and followon patches in v4.7 start to address this problem, FWIW.

Note You need to log in before you can comment on or make changes to this bug.