public inbox for linux-unionfs@vger.kernel.org
 help / color / mirror / Atom feed
* flock fails in overlay nfs-exported file
@ 2018-03-12  7:38 Eddie Horng
  2018-03-12 12:07 ` Amir Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Eddie Horng @ 2018-03-12  7:38 UTC (permalink / raw)
  To: miklos; +Cc: linux-unionfs

Hello Miklos,
I'd like to report a flock(2) problem to overlay nfs-exported files.
The error return from flock(2) is "Bad file descriptor".

Environment:
OS: Ubuntu 14.04.2 LTS
Kernel: 4.16.0-041600rc4-generic (from
http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16-rc4/)

Reproduce step:
(nfs server side)
mount -t overlay
-orw,lowerdir=/mnt/ro,upperdir=/mnt/u,workdir=/mnt/w,nfs_export=on,index=on
none /mnt/m
touch /mnt/m/foo
(nfs client side)
mount server:/mnt/m /mnt/n

flock /mnt/n/foo
failed to lock file '/mnt/n/foo': Bad file descriptor

The simple flock(2) wrap program is:
int main(int argc, void **argv) {
char *filename=argv[1];
int fd = open(filename, O_RDONLY);;
int flock_result = flock(fd, LOCK_EX | LOCK_NB);
if (flock_result != 0) {
      printf("failed to lock file '%s': %s\n", filename, strerror(errno));
      goto out;
    }
    printf("flock succeed\n");
out:
    close(fd);
}

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread
* flock fails in overlay nfs-exported file
@ 2018-03-12  7:13 Eddie Horng
  0 siblings, 0 replies; 9+ messages in thread
From: Eddie Horng @ 2018-03-12  7:13 UTC (permalink / raw)
  To: miklos; +Cc: linux-unionfs

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

Hello Miklos,
I'd like to report a flock(2) problem to overlay nfs-exported files. The
error return from flock(2) is "Bad file descriptor".

Environment:
OS: Ubuntu 14.04.2 LTS
Kernel: 4.16.0-041600rc4-generic (from
http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16-rc4/)

Reproduce step:
(nfs server side)
mount -t overlay
-orw,lowerdir=/mnt/ro,upperdir=/mnt/u,workdir=/mnt/w,nfs_export=on,index=on
none /mnt/m
touch /mnt/m/foo
(nfs client side)
mount server:/mnt/m /mnt/n

flock /mnt/n/foo
failed to lock file '/mnt/n/foo': Bad file descriptor

The simple flock(2) wrap program is:
int main(int argc, void **argv) {
char *filename=argv[1];
int fd = open(filename, O_RDONLY);;
int flock_result = flock(fd, LOCK_EX | LOCK_NB);
if (flock_result != 0) {
      printf("failed to lock file '%s': %s\n", filename, strerror(errno));
      goto out;
    }
    printf("flock succeed\n");
out:
    close(fd);
}

Thanks!

[-- Attachment #2: Type: text/html, Size: 1700 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-14  2:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-12  7:38 flock fails in overlay nfs-exported file Eddie Horng
2018-03-12 12:07 ` Amir Goldstein
2018-03-13  1:39   ` Eddie Horng
2018-03-13  6:24     ` Amir Goldstein
2018-03-13  8:40       ` Eddie Horng
2018-03-13 11:40         ` Amir Goldstein
2018-03-13 12:51       ` Jeff Layton
2018-03-14  2:11         ` Eddie Horng
  -- strict thread matches above, loose matches on Subject: below --
2018-03-12  7:13 Eddie Horng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox