All of lore.kernel.org
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: John Ratliff <john@bluemarble.net>
Cc: linux-nfs@vger.kernel.org
Subject: Re: NFS v3 file lock testing
Date: Mon, 6 Nov 2017 15:04:49 -0500	[thread overview]
Message-ID: <20171106200449.GC13456@fieldses.org> (raw)
In-Reply-To: <3a62e72f-d654-59bf-7aea-16928535bdcb@bluemarble.net>

On Sat, Nov 04, 2017 at 09:50:58PM -0400, John Ratliff wrote:
> On 11/4/2017 8:22 PM, John Ratliff wrote:
> >We recently migrated our email storage to a server sharing the
> >files with NFSv4 rather than NFS v3. We ran into a strange
> >problem, so we wanted to find out if it was related to the NFS
> >version or not.
> >
> >When I tried to mount the NFS share as an NFSv3 share, I was
> >unable to do any file locking. I was unable to diagnose the
> >problem, so I moved the disk back to the old NFS v3 server until I
> >could do further testing.
> >
> >Is there a reason I might not be able to do a file lock on an NFS
> >client with a server that does NFSv4 and NFSv3?
> >
> >The server and client are on the same subnet. There is no firewall
> >between the two systems. hosts.allow was set to ALL: ALL on both
> >client and server just to make sure that wasn't the problem.
> >
> >Reverting to the old NFSv3 server worked fine. Building another
> >NFSv3 server didn't exhibit the problem either. So I'm not sure
> >how to find out what the problem is.
> >
> >I used this program to test whether a file could be locked.
> >
> >---------------------
> >#! /usr/bin/perl
> >
> >use strict;
> >use warnings;
> >
> >use Fcntl ':flock';
> >
> >my $file = '/mnt/nfs3/test-file.lock';
> >open (my $fh, '>>', $file) or die;
> >flock($fh, LOCK_EX) or die 'could not lock file';
> >close($fh);
> >--------------------
> >
> >Normally, it returns immediately. But on the new NFSv4 server, it
> >times out and dies with 'could not lock file'. I don't know if
> >that's the proper way to do file locking on NFSv3, but I know my
> >mail server daemons can't do locking when that program fails, so
> >it looks like a reasonable test.
> >
> >Any advice for how I can diagnose this problem?
> >
> >NFSv3 client machine:
> >   Ubuntu 14.04
> >   Kernel 3.13.0 64-bit
> >   nfs-common version 1.2.8
> >
> >/etc/fstab:
> >   192.168.1.103:/mnt/nfs3 /mnt/nfs3 nfs tcp,soft,intr,nfsvers=3 0 0
> >
> >NFSv3 server machine (the broken one):
> >   Debian 9
> >   Kernel 4.9.0
> >   nfs-common version 1.3.4
> >
> >/etc/exports:
> >   /srv/nfs4 192.168.1.0/24(rw,sync,fsid=root,crossmnt,no_subtree_check)
> >   /srv/nfs4/nfs3 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
> >
> >NFSv3 server machine (the old functional one):
> >   Debian 8
> >   Kernel 3.16.0
> >   nfs-common 1.2.8
> >
> >/etc/exports:
> >   /mnt/nfs3 192.168.1.0/24(rw,sync,no_subtree_check,no_root_sqaush)
> >
> 
> 
> After checking the rpcinfo -p outputs on both servers, I noticed the
> status process wasn't running on the debian 9 server. It was not
> enabled. After starting that process, the lock returns successfully.

That would do it.  Thanks for the followup.--b.

      reply	other threads:[~2017-11-06 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05  0:22 NFS v3 file lock testing John Ratliff
2017-11-05  1:50 ` John Ratliff
2017-11-06 20:04   ` J. Bruce Fields [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171106200449.GC13456@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=john@bluemarble.net \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.