Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109987500
D36905.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36905.diff
View Options
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
@@ -537,8 +537,8 @@
if (err == 0 && op == FUSE_GETLK) {
flo = fdi.answ;
fl->l_type = flo->lk.type;
- fl->l_pid = flo->lk.pid;
if (flo->lk.type != F_UNLCK) {
+ fl->l_pid = flo->lk.pid;
fl->l_start = flo->lk.start;
if (flo->lk.end == INT64_MAX)
fl->l_len = 0;
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
@@ -278,12 +278,24 @@
ASSERT_LE(0, fd) << strerror(errno);
fl.l_start = 10;
fl.l_len = 1000;
- fl.l_pid = 0;
+ fl.l_pid = 42;
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
- fl.l_sysid = 0;
+ fl.l_sysid = 42;
ASSERT_NE(-1, fcntl(fd, F_GETLK, &fl)) << strerror(errno);
+
+ /*
+ * If no lock is found that would prevent this lock from being created,
+ * the structure is left unchanged by this system call except for the
+ * lock type which is set to F_UNLCK.
+ */
ASSERT_EQ(F_UNLCK, fl.l_type);
+ ASSERT_EQ(fl.l_pid, 42);
+ ASSERT_EQ(fl.l_start, 10);
+ ASSERT_EQ(fl.l_len, 1000);
+ ASSERT_EQ(fl.l_whence, SEEK_SET);
+ ASSERT_EQ(fl.l_sysid, 42);
+
leak(fd);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 13, 3:18 AM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16621651
Default Alt Text
D36905.diff (1 KB)
Attached To
Mode
D36905: fusefs: during F_GETLK, don't change l_pid if no lock is found
Attached
Detach File
Event Timeline
Log In to Comment