X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_iam.c;h=360b7a43502a0541a6e7a22c89ceba9a17675c60;hb=449186a71320e3406f6f06cc8cc89be71c016e9f;hp=8d10fe9e4c6ca79d2626d5d505786192a341aad2;hpb=6630a5fccdc287b61d1cf532aed37b98bb7103f2;p=fs%2Flustre-release.git diff --git a/lustre/osd-ldiskfs/osd_iam.c b/lustre/osd-ldiskfs/osd_iam.c index 8d10fe9..360b7a4 100644 --- a/lustre/osd-ldiskfs/osd_iam.c +++ b/lustre/osd-ldiskfs/osd_iam.c @@ -27,7 +27,7 @@ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -174,7 +174,7 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk) struct inode *inode = c->ic_object; struct iam_idle_head *head; struct buffer_head *bh; - int err; + int err = 0; LASSERT(mutex_is_locked(&c->ic_idle_mutex)); @@ -186,6 +186,7 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk) CERROR("%.16s: cannot load idle blocks, blk = %u, err = %d\n", LDISKFS_SB(inode->i_sb)->s_es->s_volume_name, blk, err); c->ic_idle_failed = 1; + err = err ? err : -EIO; return ERR_PTR(err); } @@ -374,7 +375,7 @@ int iam_node_read(struct iam_container *c, iam_ptr_t ptr, *bh = ldiskfs_bread(h, c->ic_object, (int)ptr, 0, &result); if (*bh == NULL) - result = -EIO; + result = result ? result : -EIO; return result; } @@ -1676,8 +1677,10 @@ iam_new_node(handle_t *h, struct iam_container *c, iam_ptr_t *b, int *e) mutex_unlock(&c->ic_idle_mutex); bh = ldiskfs_bread(NULL, inode, *b, 0, e); - if (bh == NULL) + if (bh == NULL) { + *e = *e ? *e : -EIO; return NULL; + } goto got; } @@ -1729,7 +1732,12 @@ got: return bh; newblock: - bh = osd_ldiskfs_append(h, inode, b, e); + bh = osd_ldiskfs_append(h, inode, b); + if (IS_ERR(bh)) { + *e = PTR_ERR(bh); + bh = NULL; + } + return bh; fail: