From: tianzy Date: Fri, 16 Oct 2009 07:08:37 +0000 (+0000) Subject: Branch b1_8 X-Git-Tag: v1_8_2_01~1^2~17 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4a67d4823af590c5a7ca099fef72031674b09932;p=fs%2Flustre-release.git Branch b1_8 In quota slaves, quota_chk_acq_common() shouldn't retry indefinitely if relative clients are evicted or reconnect already. This patch fixes this. b=20530 i=johann i=panda --- diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 60502b8..9534f6d 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -411,7 +411,7 @@ typedef struct { /* For quota slave, check whether specified uid/gid's remaining quota * can finish a block_write or inode_create rpc. It updates the pending * record of block and inode, acquires quota if necessary */ - int (*quota_chkquota) (struct obd_device *, unsigned int, unsigned int, + int (*quota_chkquota) (struct obd_export *, unsigned int, unsigned int, int, int [], quota_acquire, struct obd_trans_info *, struct inode *, int); @@ -627,7 +627,7 @@ static inline int lquota_acquire(quota_interface_t *interface, } static inline int lquota_chkquota(quota_interface_t *interface, - struct obd_device *obd, + struct obd_export *exp, unsigned int uid, unsigned int gid, int count, int pending[2], struct obd_trans_info *oti, struct inode *inode, int frags) @@ -637,7 +637,7 @@ static inline int lquota_chkquota(quota_interface_t *interface, QUOTA_CHECK_OP(interface, chkquota); QUOTA_CHECK_OP(interface, acquire); - rc = QUOTA_OP(interface, chkquota)(obd, uid, gid, count, pending, + rc = QUOTA_OP(interface, chkquota)(exp, uid, gid, count, pending, QUOTA_OP(interface, acquire), oti, inode, frags); RETURN(rc); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 220de40..7a25753 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1210,7 +1210,7 @@ int mds_open(struct mds_update_record *rec, int offset, * be NULL, b=14840 */ ids[0] = current->fsuid; ids[1] = gid; - lquota_chkquota(mds_quota_interface_ref, obd, + lquota_chkquota(mds_quota_interface_ref, req->rq_export, ids[0], ids[1], 1, quota_pending, NULL, NULL, 0); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 0c41de0..6df7730 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -1061,7 +1061,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, * be NULL, b=14840 */ ids[0] = current->fsuid; ids[1] = gid; - lquota_chkquota(mds_quota_interface_ref, obd, ids[0], ids[1], + lquota_chkquota(mds_quota_interface_ref, req->rq_export, ids[0], ids[1], 1, quota_pending, NULL, NULL, 0); switch (type) { diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index a927af4..bc884ad 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -665,9 +665,11 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, /* we try to get enough quota to write here, and let ldiskfs * decide if it is out of quota or not b=14783 */ - lquota_chkquota(filter_quota_interface_ref, obd, qcids[0], qcids[1], - quota_pages, quota_pending, oti, inode, - obj->ioo_bufcnt); + rc = lquota_chkquota(filter_quota_interface_ref, exp, qcids[0], + qcids[1], quota_pages, quota_pending, oti, + inode, obj->ioo_bufcnt); + if (rc == -ENOTCONN) + GOTO(cleanup, rc); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); cleanup_phase = 2; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index d10fb82..e344f67 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1116,6 +1116,12 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) rc = obd_commitrw(OBD_BRW_WRITE, exp, &repbody->oa, objcount, ioo, remote_nb, npages, local_nb, oti, rc); + if (rc == -ENOTCONN) + /* quota acquire process has been given up because + * either the client has been evicted or the client + * has timed out the request already */ + no_reply = 1; + if (unlikely(client_cksum != server_cksum && rc == 0)) { int new_cksum = ost_checksum_bulk(desc, OST_WRITE, cksum_type); char *msg; diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 3d48a02..849d890 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -356,12 +356,13 @@ static int quota_check_common(struct obd_device *obd, unsigned int uid, RETURN(rc); } -static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, +static int quota_chk_acq_common(struct obd_export *exp, unsigned int uid, unsigned int gid, int count, int pending[2], int isblk, quota_acquire acquire, struct obd_trans_info *oti, struct inode *inode, int frags) { + struct obd_device *obd = exp->exp_obd; struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt; struct timeval work_start; struct timeval work_end; @@ -371,6 +372,12 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, ENTRY; CDEBUG(D_QUOTA, "check quota for %s\n", obd->obd_name); + if (isblk && (exp->exp_failed || exp->exp_abort_active_req)) + /* If the client has been evicted or if it + * timed out and tried to reconnect already, + * abort the request immediately */ + RETURN(-ENOTCONN); + /* Unfortunately, if quota master is too busy to handle the * pre-dqacq in time and quota hash on ost is used up, we * have to wait for the completion of in flight dqacq/dqrel, @@ -417,6 +424,11 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, break; } + if (isblk && (exp->exp_failed || exp->exp_abort_active_req)) + /* The client has been evicted or tried to + * to reconnect already, abort the request */ + RETURN(-ENOTCONN); + /* -EBUSY and others, wait a second and try again */ if (rc < 0) { cfs_waitq_t waitq; @@ -459,6 +471,8 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, LQUOTA_WAIT_FOR_CHK_INO, timediff); + if (rc > 0) + rc = 0; RETURN(rc); } @@ -485,13 +499,13 @@ int quota_is_set(struct obd_device *obd, unsigned int uid, return q_set; } -static int filter_quota_check(struct obd_device *obd, unsigned int uid, +static int filter_quota_check(struct obd_export *exp, unsigned int uid, unsigned int gid, int npage, int pending[2], quota_acquire acquire, struct obd_trans_info *oti, struct inode *inode, int frags) { - return quota_is_set(obd, uid, gid, QB_SET) ? - quota_chk_acq_common(obd, uid, gid, npage, pending, + return quota_is_set(exp->exp_obd, uid, gid, QB_SET) ? + quota_chk_acq_common(exp, uid, gid, npage, pending, LQUOTA_FLAGS_BLK, acquire, oti, inode, frags) : 0; } @@ -634,13 +648,13 @@ static int mds_quota_fs_cleanup(struct obd_device *obd) RETURN(0); } -static int mds_quota_check(struct obd_device *obd, unsigned int uid, +static int mds_quota_check(struct obd_export *exp, unsigned int uid, unsigned int gid, int inodes, int pending[2], quota_acquire acquire, struct obd_trans_info *oti, struct inode *inode, int frags) { - return quota_is_set(obd, uid, gid, QI_SET) ? - quota_chk_acq_common(obd, uid, gid, inodes, pending, 0, + return quota_is_set(exp->exp_obd, uid, gid, QI_SET) ? + quota_chk_acq_common(exp, uid, gid, inodes, pending, 0, acquire, oti, inode, frags) : 0; }