Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/lib/libperfuse Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/d29eee559056
branches:  netbsd-9
changeset: 458171:d29eee559056
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 13 14:44:37 2019 +0000

description:
Pull up following revision(s) (requested by manu in ticket #50):

        lib/libperfuse/ops.c: revision 1.87

Rollback directory filehandle screening for FUSE lock operations
libfuse has a different usage of filehandles for files and directories.

A directory filehandle is valid only for directory operations such
as OPENDIR, READDIR, RELEASEDIR, FSYNCDIR. Change of src/lib/libperfuse/ops.c
1.85-1.86 made sure filehandles of directories were only sent for that
operations.

However, the status of lock operations GETLK, SETLK, SETLKW was overlooked.

The only FUSE filesystem I found using locks is GlusterFS, and it needs
directory filehandles to be provided on lock operations, otherwise locking
crashes the filesystem. Hence this change brings back filehandles for
lock operations on directories.

diffstat:

 lib/libperfuse/ops.c |  17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diffs (37 lines):

diff -r fdb28a42e3f4 -r d29eee559056 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Tue Aug 13 14:35:55 2019 +0000
+++ b/lib/libperfuse/ops.c      Tue Aug 13 14:44:37 2019 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.86 2019/02/09 02:22:45 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.86.2.1 2019/08/13 14:44:37 martin Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -2976,24 +2976,15 @@
         * expect one. E.g.: if we provide none, GlusterFS logs an error
         * "0-glusterfs-fuse: xl is NULL"
         *
-        * There is one exception with directories where filehandle
-        * is not included, because libfuse uses different filehandle
-        * in opendir/releasedir/readdir/fsyncdir compared to other 
-        * operations. Who locks a directory anyway?
-        *
         * We need the read file handle if the file is open read only,
         * in order to support shared locks on read-only files.
         * NB: The kernel always sends advlock for read-only
         * files at exit time when the process used lock, see
         * sys_exit -> exit1 -> fd_free -> fd_close -> VOP_ADVLOCK
         */
-       if (!PN_ISDIR(opc)) {
-               if ((fh = perfuse_get_fh(opc, FREAD)) == FUSE_UNKNOWN_FH) {
-                       error = EBADF;
-                       goto out;
-               }
-       } else {
-               fh = FUSE_UNKNOWN_FH;
+       if ((fh = perfuse_get_fh(opc, FREAD)) == FUSE_UNKNOWN_FH) {
+               error = EBADF;
+               goto out;
        }
 
        ps = puffs_getspecific(pu);



Home | Main Index | Thread Index | Old Index