diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 8476a298ca3f36b4c662932a405f1c7eaea36d47..7331230d7013757d6f2dd8c08799d7cc1b52826a 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -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> diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2f75521fd95eea1bea5c3a170a328a831f27649f..98b42e7ff09a347f8024a38b533dab6834ee798a 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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);