Page MenuHomeFreeBSD

D30622.diff
No OneTemporary

D30622.diff

diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -466,14 +466,14 @@
fdisp_make_vp(&fdi, op, vp, td, cred);
fli = fdi.indata;
fli->fh = fufh->fh_id;
- fli->owner = fl->l_pid;
+ fli->owner = td->td_proc->p_pid;
fli->lk.start = fl->l_start;
if (fl->l_len != 0)
fli->lk.end = fl->l_start + fl->l_len - 1;
else
fli->lk.end = INT64_MAX;
fli->lk.type = fl->l_type;
- fli->lk.pid = fl->l_pid;
+ fli->lk.pid = td->td_proc->p_pid;
err = fdisp_wait_answ(&fdi);
fdisp_destroy(&fdi);
diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc
--- a/tests/sys/fs/fusefs/locks.cc
+++ b/tests/sys/fs/fusefs/locks.cc
@@ -228,7 +228,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = getpid();
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -247,7 +247,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -256,11 +256,16 @@
return (in.header.opcode == FUSE_GETLK &&
in.header.nodeid == ino &&
in.body.getlk.fh == FH &&
+ /*
+ * Though it seems useless, libfuse expects the
+ * owner and pid fields to be set during
+ * FUSE_GETLK.
+ */
in.body.getlk.owner == (uint32_t)pid &&
+ in.body.getlk.lk.pid == (uint64_t)pid &&
in.body.getlk.lk.start == 10 &&
in.body.getlk.lk.end == 1009 &&
- in.body.getlk.lk.type == F_RDLCK &&
- in.body.getlk.lk.pid == (uint64_t)pid);
+ in.body.getlk.lk.type == F_RDLCK);
}, Eq(true)),
_)
).WillOnce(Invoke(ReturnImmediate([=](auto in, auto& out) {
@@ -273,7 +278,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -290,7 +295,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
pid_t pid2 = 1235;
expect_lookup(RELPATH, ino);
@@ -300,11 +305,16 @@
return (in.header.opcode == FUSE_GETLK &&
in.header.nodeid == ino &&
in.body.getlk.fh == FH &&
+ /*
+ * Though it seems useless, libfuse expects the
+ * owner and pid fields to be set during
+ * FUSE_GETLK.
+ */
in.body.getlk.owner == (uint32_t)pid &&
+ in.body.getlk.lk.pid == (uint64_t)pid &&
in.body.getlk.lk.start == 10 &&
in.body.getlk.lk.end == 1009 &&
- in.body.getlk.lk.type == F_RDLCK &&
- in.body.getlk.lk.pid == (uint64_t)pid);
+ in.body.getlk.lk.type == F_RDLCK);
}, Eq(true)),
_)
).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) {
@@ -319,7 +329,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -368,7 +378,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -378,7 +388,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_UNLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -394,7 +404,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -404,7 +414,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -420,7 +430,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -430,7 +440,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 0;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -446,7 +456,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -456,7 +466,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -484,7 +494,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = getpid();
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;
@@ -504,7 +514,7 @@
uint64_t ino = 42;
struct flock fl;
int fd;
- pid_t pid = 1234;
+ pid_t pid = getpid();
expect_lookup(RELPATH, ino);
expect_open(ino, 0, 1);
@@ -514,7 +524,7 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = pid;
+ fl.l_pid = 0;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
fl.l_sysid = 0;

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 20, 12:13 PM (18 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39295097
Default Alt Text
D30622.diff (4 KB)

Event Timeline