Florisjan
Posts: 19
Joined: Mon Apr 11, 2016 2:49 pm

Stale file handle, but still accesible

Wed Jan 11, 2017 11:41 am

Hello,

I have a 'ramdrive' on a pi host mounted on another client pi. It is the /dev/shm folder used by RPI cam control. Here is the mount instruction used for it:

sudo mount -t cifs -o username=pi,password=\'?????' \"pib.local/ramdrive\" /mnt/pibramdrive

I use a bash script to copy jpegs to it, which are in turn processed swiftly and deleted by a python script on the host pi.
The python script raised an unhandled exception and stopped, so the drive was flooded. I a not certain that is what caused this though. When I noticed the handler script had stopped I started looking for the cause and noticed the following.

pi@frontcam:/mnt $ ls -l
ls: cannot access uberpiramdrive: Stale file handle
total 32
drwxr-xr-x 2 root root 0 Dec 7 19:34 camshare
d????????? ? ? ? ? ? uberpiramdrive
drwxrwxrwx 7 pi users 32768 Jan 9 23:48 usbdrive

So I did a umount -f on it and then mounted it again and it worked again. But then the script stopped again (this is when I found the unhandled exception, still not certain if it is relevant.) and looked again.

I still get a stale file handle. However I can go into the directory and it works fine, although it does not appear as a mounted directory in the ls.

pi@frontcam:/mnt/pibramdrive $ ls
camrgb.jpg frontdoorrgb.jpg mjpeg

After umount -f I can access the directory, no more stale. Then after mounting it again, all is fine and the directoy appears as mounted again.

Weird things going on, anybody got an explanation?

Fj

User avatar
topguy
Posts: 6049
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Stale file handle, but still accesible

Wed Jan 11, 2017 12:39 pm

Remember that "/mnt/piramdrive" is just another directory on your SD card. This directory can contain files if you accidentally copy something to that path when nothing is mounted. those files are just temporarily hidden when you mount something there.

Florisjan
Posts: 19
Joined: Mon Apr 11, 2016 2:49 pm

Re: Stale file handle, but still accesible

Thu Jan 12, 2017 1:59 pm

That's right, I actually have a file there called 'notmounted' so I can tell that it isn't mounted. The stale problem does not occur when there is no mount and the directory and file in it are accessible.
Fj

Return to “Raspbian”