xfs
[Top] [All Lists]

Re: XFS filesystem claims to be mounted after a disconnect

To: Martin Papik <mp6058@xxxxxxxxx>
Subject: Re: XFS filesystem claims to be mounted after a disconnect
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 3 Jun 2014 09:41:36 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <538C5E67.6090005@xxxxxxxxx>
References: <5363B4C9.4000900@xxxxxxxxxxx> <5363CB5E.3090008@xxxxxxxxx> <5363CD70.3000006@xxxxxxxxxxx> <5363DBD7.4060002@xxxxxxxxx> <5363E65C.6010006@xxxxxxxxxxx> <5363ECE8.6030706@xxxxxxxxx> <20140502233512.GE26353@dastard> <536432A0.6000405@xxxxxxxxx> <20140503030221.GJ26353@dastard> <538C5E67.6090005@xxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Jun 02, 2014 at 02:22:15PM +0300, Martin Papik wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> 
> >> How can I detect this situation? I mean I didn't see anything in 
> >> /proc/mounts or references to the mount point from /proc/<pid>/*,
> >> so I only managed to correct it (chdir elsewhere) by chance on a
> >> hunch. Would it not be desirable to know that there's a phantom
> >> FS referenced by a number of processes?
> > 
> > lsof.
> 
> No good.

lsof reports such things as belonging to / because it can't find the
correct path for them. Indeed, you can't find them by filtering on
mount point, file or anything else. But they are there.

e.g:

$ sudo mount /dev/vdc /mnt/scratch
$ cd /mnt/scratch
$ sudo umount -l /mnt/scratch
$ sleep 300
$ cd ~
$ ps -ef |grep [s]leep
dave     16341  7432  0 09:27 pts/1    00:00:00 sleep 300
$ sudo lsof |grep sleep
sleep     16341            dave  cwd       DIR             253,32        6      
   96 /
sleep     16341            dave  rtd       DIR                8,1     4096      
    2 /
sleep     16341            dave  txt       REG                8,1    31208      
32607 /bin/sleep
sleep     16341            dave  mem       REG                8,1  1742520     
245384 /lib/x86_64-linux-gnu/libc-2.17.so
sleep     16341            dave  mem       REG                8,1   145160     
245381 /lib/x86_64-linux-gnu/ld-2.17.so
sleep     16341            dave  mem       REG                8,1  1607584      
98063 /usr/lib/locale/locale-archive
sleep     16341            dave    0u      CHR              136,1      0t0      
    4 /dev/pts/1
sleep     16341            dave    1u      CHR              136,1      0t0      
    4 /dev/pts/1
sleep     16341            dave    2u      CHR              136,1      0t0      
    4 /dev/pts/1

See the first two DIR lines? They have different devices but the
same path (/). That's what you need to look for - the non-root device
with a root path - in this case 253,32:

$ ls -l /dev/vdc
brw-rw---- 1 root disk 253, 32 Jun  3 09:01 /dev/vdc
$

With this knowledge, the simple way:

$ sudo lsof |grep "253,32"
bash       7432            dave  cwd       DIR             253,32        6      
   96 /
sleep     16341            dave  cwd       DIR             253,32        6      
   96 /

There's the two processes  holding references to the unmounted
filesystem.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>