Skip to content
Snippets Groups Projects
Commit 0b720f02 authored by Oleg Drokin's avatar Oleg Drokin
Browse files

b=13276

r=shadow,wangdi

check return value of ll_node_from_inode in ll_file_read and ll_file_sendfile,
do not try to access uninitialised locks tree on error exit from
ll_file_write
parent aa2c223f
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,12 @@ Details : Flock locks might destroy just granted lock if it could be merged
so teach ldlm_cli_enquque_fini that this is a valid case for
flock locks.
Severity : minor
Bugzilla : 13276
Frequency : rare
Description: Oops in read and write path when failing to allocate lock.
Details : Check if lock allocation failed and return error back.
--------------------------------------------------------------------------------
2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com>
......
......@@ -1362,6 +1362,10 @@ repeat:
}
node = ll_node_from_inode(inode, *ppos, end, LCK_PR);
if (IS_ERR(node)){
GOTO(out, rc = PTR_ERR(node));
}
tree.lt_fd = LUSTRE_FPRIVATE(file);
rc = ll_tree_lock(&tree, node, buf, count,
file->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0);
......@@ -1536,7 +1540,7 @@ repeat:
if (*ppos >= maxbytes) {
send_sig(SIGXFSZ, current, 0);
GOTO(out, retval = -EFBIG);
GOTO(out_unlock, retval = -EFBIG);
}
if (*ppos + count > maxbytes)
count = maxbytes - *ppos;
......@@ -1548,9 +1552,10 @@ repeat:
retval = generic_file_write(file, buf, chunk, ppos);
ll_rw_stats_tally(ll_i2sbi(inode), current->pid, file, count, 1);
out:
out_unlock:
ll_tree_unlock(&tree);
out:
if (retval > 0) {
buf += retval;
count -= retval;
......@@ -1602,6 +1607,9 @@ static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
RETURN(generic_file_sendfile(in_file, ppos, count, actor, target));
node = ll_node_from_inode(inode, *ppos, *ppos + count - 1, LCK_PR);
if (IS_ERR(node))
RETURN(PTR_ERR(node));
tree.lt_fd = LUSTRE_FPRIVATE(in_file);
rc = ll_tree_lock(&tree, node, NULL, count,
in_file->f_flags & O_NONBLOCK?LDLM_FL_BLOCK_NOWAIT:0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment