Commit b504ec5c authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Pavel Emelyanov

locks: Check syscalls return values in lock probing

travis-ci: success for series starting with [1/1] locks: Check syscalls return values in lock probing
Signed-off-by: 's avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: 's avatarEugene Batalov <eabatalov89@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 52a047ba
......@@ -197,9 +197,13 @@ static int lock_check_fd(int lfd, struct file_lock *fl)
*/
pr_debug(" `- downgrading lock back\n");
if (fl->fl_ltype & LOCK_MAND)
flock(lfd, fl->fl_ltype);
ret = flock(lfd, fl->fl_ltype);
else if (fl->fl_ltype == F_RDLCK)
flock(lfd, LOCK_SH);
ret = flock(lfd, LOCK_SH);
if (ret) {
pr_err("Can't downgrade lock back %d\n", ret);
return -1;
}
}
return 1;
......@@ -250,7 +254,11 @@ static int lock_ofd_check_fd(int lfd, struct file_lock *fl)
else
lck.l_type = F_RDLCK;
fcntl(lfd, F_OFD_SETLK, &lck);
ret = fcntl(lfd, F_OFD_SETLK, &lck);
if (ret) {
pr_err("Can't downgrade lock back %d\n", ret);
return -1;
}
}
return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment