Find the answer to your Linux question:
Results 1 to 4 of 4
Hey all, So currently I have a system running on the 2.6.18.8 kernel, and I am using NFS to expand it's storage capabilities. This works fine when my connection is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    3

    Question statfs & remote filesystem


    Hey all,

    So currently I have a system running on the 2.6.18.8 kernel, and I am using NFS to expand it's storage capabilities. This works fine when my connection is up and running, however when the NFS goes down any scripts I have running that touch the NFS mount will hang. Strace shows the hang at statfs. I looked through google, but I couldn't find anything. Has there ever been an effort put into place that allows statfs to timeout on a disconnected mount?
    I did see that there was a statvfs, but I'm not sure if this provides what I want. Is this possible?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    If you wrote your own C application that queried the remote file system periodically, but that enables a timer interrupt that could signal it when the connection times out, that application could conceivably signal in turn the hung scripts so that they can then terminate normally. You could write it as a server application that your scripts send a message to with their PID when they start so you know which processes are likely needing to be signalled. I'm not sure there isn't something better to do this, but it's a thought.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    3

    Yeah..

    Yeah I tried something like that. I tried using an alarm to give the stat calls a 30 second timeout and if it fails to return to kill the stat. However stat's sigmask doesn't allow alarm signals, so it didn't work out. I'm considering having stat run in a separate thread and then having the alarm just kill that thread with a sigterm instead. I was just hoping that someone had tried this before, it seems like a problem that other people would have experienced.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    You could use a POSIX timer which allows you to register a callback function. Check the timer_create(), timer_gettime(), timer_settime(), timer_delete(), and timer_getoverrun() functions. I'm not sure that they don't use signals, but may be invoked by the kernel. If someone knows for sure, I'd appreciate hearing.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •