From: Kyle Lippincott Date: Mon, 12 Sep 2022 19:26:53 +0000 (-0700) Subject: Move try_get_path2 earlier in the file X-Git-Tag: fuse-3.13.0~13 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=30d423ee74496505f89e9db1cb23aafb1cc653a8;p=qemu-gpiodev%2Flibfuse.git Move try_get_path2 earlier in the file --- diff --git a/lib/fuse.c b/lib/fuse.c index 17850e3..606c3dd 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -1091,6 +1091,27 @@ static void queue_element_unlock(struct fuse *f, struct lock_queue_element *qe) } } +static int try_get_path2(struct fuse *f, fuse_ino_t nodeid1, const char *name1, + fuse_ino_t nodeid2, const char *name2, + char **path1, char **path2, + struct node **wnode1, struct node **wnode2) +{ + int err; + + /* FIXME: locking two paths needs deadlock checking */ + err = try_get_path(f, nodeid1, name1, path1, wnode1, true); + if (!err) { + err = try_get_path(f, nodeid2, name2, path2, wnode2, true); + if (err) { + struct node *wn1 = wnode1 ? *wnode1 : NULL; + + unlock_path(f, nodeid1, wn1, NULL); + free(*path1); + } + } + return err; +} + static void queue_element_wakeup(struct fuse *f, struct lock_queue_element *qe) { int err; @@ -1307,27 +1328,6 @@ static int check_dir_loop(struct fuse *f, } #endif -static int try_get_path2(struct fuse *f, fuse_ino_t nodeid1, const char *name1, - fuse_ino_t nodeid2, const char *name2, - char **path1, char **path2, - struct node **wnode1, struct node **wnode2) -{ - int err; - - /* FIXME: locking two paths needs deadlock checking */ - err = try_get_path(f, nodeid1, name1, path1, wnode1, true); - if (!err) { - err = try_get_path(f, nodeid2, name2, path2, wnode2, true); - if (err) { - struct node *wn1 = wnode1 ? *wnode1 : NULL; - - unlock_path(f, nodeid1, wn1, NULL); - free(*path1); - } - } - return err; -} - static int get_path2(struct fuse *f, fuse_ino_t nodeid1, const char *name1, fuse_ino_t nodeid2, const char *name2, char **path1, char **path2,