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);
}
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);
}
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
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 */
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 */
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;
}
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;
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++;
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);
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;
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)
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;