提交 a7a2ff8a 编写于 作者: D David Teigland 提交者: Steven Whitehouse

[GFS2] return conflicts for GETLK

We weren't returning the correct result when GETLK found a conflict,
which is indicated by userspace passing back a 1.

Signed-off-by: Abhijith Das <adas redhat com>
Signed-off-by: David Teigland <teigland redhat com>
Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
上级 d88101d4
...@@ -254,16 +254,20 @@ int gdlm_plock_get(void *lockspace, struct lm_lockname *name, ...@@ -254,16 +254,20 @@ int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
} }
spin_unlock(&ops_lock); spin_unlock(&ops_lock);
/* info.rv from userspace is 1 for conflict, 0 for no-conflict,
-ENOENT if there are no locks on the file */
rv = op->info.rv; rv = op->info.rv;
fl->fl_type = F_UNLCK; fl->fl_type = F_UNLCK;
if (rv == -ENOENT) if (rv == -ENOENT)
rv = 0; rv = 0;
else if (rv == 0 && op->info.pid != fl->fl_pid) { else if (rv > 0) {
fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
fl->fl_pid = op->info.pid; fl->fl_pid = op->info.pid;
fl->fl_start = op->info.start; fl->fl_start = op->info.start;
fl->fl_end = op->info.end; fl->fl_end = op->info.end;
rv = 0;
} }
kfree(op); kfree(op);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册