From: Jan Kara Subject: Re: [PATCH 2/6] quota: Add proper error handling on quota initialization. Date: Fri, 7 May 2010 18:44:54 +0200 Message-ID: <20100507164454.GF3700@quack.suse.cz> References: <1270749865-25441-1-git-send-email-dmonakhov@openvz.org> <1270749865-25441-2-git-send-email-dmonakhov@openvz.org> <1270749865-25441-3-git-send-email-dmonakhov@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz, hch@infradead.org, sandeen@redhat.com To: Dmitry Monakhov Return-path: Received: from cantor2.suse.de ([195.135.220.15]:56142 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752245Ab0EGQo5 (ORCPT ); Fri, 7 May 2010 12:44:57 -0400 Content-Disposition: inline In-Reply-To: <1270749865-25441-3-git-send-email-dmonakhov@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu 08-04-10 22:04:21, Dmitry Monakhov wrote: > Currently dqget_initialize() is a black-box so IO errors are simply > ignored. In order to pass to the caller real error codes quota > interface must being redesigned in following way. > > - return real error code from dqget() > - return real error code from dquot_initialize() > > Now filesystem it is filesystem's responsibility to dquot_initialize() > return value. > > Signed-off-by: Dmitry Monakhov > --- > fs/ocfs2/file.c | 18 ++++++-- > fs/ocfs2/quota_local.c | 10 ++-- > fs/quota/dquot.c | 101 +++++++++++++++++++++++++++++++--------------- > include/linux/quotaops.h | 5 +- > 4 files changed, 90 insertions(+), 44 deletions(-) > ... > for (cnt = 0; cnt < MAXQUOTAS; cnt++) { > if (type != -1 && cnt != type) > continue; > /* Avoid races with quotaoff() */ > if (!sb_has_quota_active(sb, cnt)) > continue; > - if (!inode->i_dquot[cnt]) { > - inode->i_dquot[cnt] = got[cnt]; > - got[cnt] = NULL; > - /* > - * Make quota reservation system happy if someone > - * did a write before quota was turned on > - */ > - rsv = inode_get_rsv_space(inode); > - if (unlikely(rsv)) > - dquot_resv_space(inode->i_dquot[cnt], rsv); > + if (inode->i_dquot[cnt]) > + continue; > + if (unlikely(IS_ERR(got[cnt]))) { > + err = (int)PTR_ERR(got[cnt]); ^^^^ Why is (int) needed? > @@ -1721,15 +1742,29 @@ static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask > space = cur_space + rsv_space; > /* Build the transfer_from list and check the limits */ > for (cnt = 0; cnt < MAXQUOTAS; cnt++) { > - if (!transfer_to[cnt]) > + if (!(mask & (1 << cnt))) > continue; > + if (unlikely(IS_ERR(transfer_to[cnt]))) { > + ret = (int)PTR_ERR(transfer_to[cnt]); ^^^^^ And here as well. Honza -- Jan Kara SUSE Labs, CR