diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2adabe9fd9cab645345d20b522723a9746699b40..7f589c6ddde39251e02280972a73589b6dc1d710 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -365,8 +365,6 @@ int ll_och_fill(struct inode *inode, struct lookup_intent *it, mdc_set_open_replay_data(ll_i2mdexp(inode), och, LUSTRE_IT(it)->it_data); - if (S_ISREG(inode->i_mode) && (body->valid & OBD_MD_CAPA)) - rc = ll_set_capa(inode, it); RETURN(rc); } @@ -374,11 +372,12 @@ int ll_local_open(struct file *file, struct lookup_intent *it, struct obd_client_handle *och) { struct ll_file_data *fd; + struct inode *inode = file->f_dentry->d_inode; int rc = 0; ENTRY; if (och) { - rc = ll_och_fill(file->f_dentry->d_inode, it, och); + rc = ll_och_fill(inode, it, och); if (rc) RETURN(rc); } @@ -398,10 +397,11 @@ int ll_local_open(struct file *file, struct lookup_intent *it, LASSERT(fd != NULL); file->private_data = fd; - ll_readahead_init(file->f_dentry->d_inode, &fd->fd_ras); + ll_readahead_init(inode, &fd->fd_ras); fd->fd_omode = it->it_flags; - RETURN(0); + rc = ll_set_capa(inode, it); + RETURN(rc); } /* Open a file, and (for the very first open) create objects on the OSTs at diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c index 99a9ef3234c801e4892dcae94b0360f366e96840..3f670d809769a43ff5a81eb7b569f9ba51502f4c 100644 --- a/lustre/llite/llite_capa.c +++ b/lustre/llite/llite_capa.c @@ -220,12 +220,19 @@ int ll_set_capa(struct inode *inode, struct lookup_intent *it) struct obd_capa *ocapa; struct ll_inode_info *lli = ll_i2info(inode); unsigned long expiry; - ENTRY; + + if (!S_ISREG(inode->i_mode)) + return 0; body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body)); LASSERT(body != NULL); /* reply already checked out */ LASSERT_REPSWABBED(req, 1); /* and swabbed down */ + if (!(body->valid & OBD_MD_CAPA)) + return 0; + + ENTRY; + capa = lustre_msg_buf(req->rq_repmsg, 7, sizeof (*capa)); LASSERT(capa != NULL); /* reply already checked out */ LASSERT_REPSWABBED(req, 7); /* and swabbed down */ diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 40788608cd7d9598a74561c27b565cb4d3dc3762..e69084fccf87b753a781fb7c4582e74e5c502033 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -112,7 +112,7 @@ mdc_interpret_getattr(struct ptlrpc_request *req, void *unused, int rc) ENTRY; if (rc) { - DEBUG_REQ(D_ERROR, req, + DEBUG_REQ(D_WARNING, req, "async getattr failed: rc = %d", rc); RETURN(rc); } diff --git a/lustre/mds/mds_capa.c b/lustre/mds/mds_capa.c index 5e6397429a2c0a9eb7411d3687b6a77e25ed0e15..c7d0bda3bae67da866ac5050e175c164cfa06d4d 100644 --- a/lustre/mds/mds_capa.c +++ b/lustre/mds/mds_capa.c @@ -497,7 +497,7 @@ int mds_pack_capa(struct obd_device *obd, struct mds_export_data *med, mfd = mds_handle2mfd(&req_body->handle); if (mfd == NULL) { - DEBUG_CAPA(D_ERROR, req_capa, "no handle "LPX64" for", + DEBUG_CAPA(D_WARNING, req_capa, "no handle "LPX64" for", req_body->handle.cookie); RETURN(-ESTALE); } diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index 24d34ec1db7f3b8312195ae7c4c201bf8bbff6e4..7c984990d5c11f824b11279edd165d168c45e0a2 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -55,6 +55,8 @@ struct hlist_head *capa_hash; struct list_head capa_list[3]; static int capa_count[3] = { 0 }; +static char *capa_type_name[] = { "client", "mds", "filter" }; + /* TODO: mdc and llite all need this, so define it here. * in the future it will be moved to ll_sb_info to support multi- * mount point */ @@ -109,7 +111,8 @@ find_capa(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid, if (ouid != uid) continue; - DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "found"); + DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "found %s", + capa_type_name[ocapa->c_type]); return ocapa; } @@ -245,7 +248,8 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa) capa_count[type]++; - DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new"); + DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "new %s", + capa_type_name[type]); if (type != CLIENT_CAPA && capa_count[type] > CAPA_CACHE_SIZE) { struct list_head *node = capa_list[type].next; @@ -259,8 +263,9 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa) node = node->next; if (atomic_read(&tcapa->c_refc) > 0) continue; - DEBUG_CAPA(D_CACHE, &ocapa->c_capa, - "free unused"); + DEBUG_CAPA(D_CACHE, &tcapa->c_capa, + "free unused %s", + capa_type_name[type]); __capa_put(tcapa); destroy_capa(tcapa); count++; @@ -293,7 +298,8 @@ void capa_put(struct obd_capa *ocapa) if (!ocapa) return; - DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "put"); + DEBUG_CAPA(D_CACHE, &ocapa->c_capa, "put %s", + capa_type_name[ocapa->c_type]); spin_lock(&capa_lock); if (ocapa->c_type == CLIENT_CAPA) { list_del_init(&ocapa->c_lli_list); @@ -305,7 +311,7 @@ void capa_put(struct obd_capa *ocapa) spin_unlock(&capa_lock); } -static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type) +struct obd_capa *capa_renew(struct lustre_capa *capa, int type) { uid_t uid = capa->lc_uid; int capa_op = capa->lc_op; @@ -317,8 +323,10 @@ static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type) spin_lock(&capa_lock); ocapa = find_capa(head, uid, capa_op, mdsid, ino, type); - if (ocapa) + if (ocapa) { + DEBUG_CAPA(D_INFO, capa, "renew %s", capa_type_name[type]); do_update_capa(ocapa, capa); + } spin_unlock(&capa_lock); if (!ocapa) @@ -327,13 +335,6 @@ static struct obd_capa *update_capa_locked(struct lustre_capa *capa, int type) return ocapa; } -struct obd_capa *capa_renew(struct lustre_capa *capa, int type) -{ - DEBUG_CAPA(D_INFO, capa, "renew"); - - return update_capa_locked(capa, type); -} - void capa_hmac(struct crypto_tfm *tfm, __u8 *key, struct lustre_capa *capa) { int keylen = CAPA_KEY_LEN;