staging: lustre: lov: cleanup when cl_io_iter_init() fails
In lov_io_iter_init(), if cl_io_iter_init() against sub io fails, it should call cl_io_iter_fini() to cleanup leftover information; Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271 Reviewed-on: http://review.whamcloud.com/16456 Reviewed-by: Bobi Jam <bobijam@hotmail.com> Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
719e9e08aa
commit
5fd8f8b8d5
@ -424,21 +424,23 @@ static int lov_io_iter_init(const struct lu_env *env,
|
||||
|
||||
end = lov_offset_mod(end, 1);
|
||||
sub = lov_sub_get(env, lio, stripe);
|
||||
if (!IS_ERR(sub)) {
|
||||
lov_io_sub_inherit(sub->sub_io, lio, stripe,
|
||||
start, end);
|
||||
rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
|
||||
lov_sub_put(sub);
|
||||
CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n",
|
||||
stripe, start, end);
|
||||
} else {
|
||||
if (IS_ERR(sub)) {
|
||||
rc = PTR_ERR(sub);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
list_add_tail(&sub->sub_linkage, &lio->lis_active);
|
||||
else
|
||||
lov_io_sub_inherit(sub->sub_io, lio, stripe, start, end);
|
||||
rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
|
||||
if (rc)
|
||||
cl_io_iter_fini(sub->sub_env, sub->sub_io);
|
||||
lov_sub_put(sub);
|
||||
if (rc)
|
||||
break;
|
||||
|
||||
CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n",
|
||||
stripe, start, end);
|
||||
|
||||
list_add_tail(&sub->sub_linkage, &lio->lis_active);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user