if (rc)
GOTO(out_mdc, rc = -abs(rc));
+ atomic_inc(&lli->lli_open_count);
+
file->private_data = fd;
RETURN(0);
rc = -abs(rc2);
GOTO(out_fd, rc);
}
- CDEBUG(D_HA, "matched req %p xid "LPD64" transno "LPD64" op %d->%s:%d\n",
- fd->fd_req, fd->fd_req->rq_xid, fd->fd_req->rq_repmsg->transno,
- fd->fd_req->rq_reqmsg->opc,
+ CDEBUG(D_HA, "matched req %p xid "LPD64" transno "LPD64" op "
+ "%d->%s:%d\n", fd->fd_req, fd->fd_req->rq_xid,
+ fd->fd_req->rq_repmsg->transno, fd->fd_req->rq_reqmsg->opc,
fd->fd_req->rq_import->imp_connection->c_remote_uuid,
fd->fd_req->rq_import->imp_client->cli_request_portal);
ptlrpc_req_finished(fd->fd_req);
- rc = obd_cancel_unused(ll_i2obdconn(inode), lsm, 0);
- if (rc)
- CERROR("obd_cancel_unused: %d\n", rc);
+ if (atomic_dec_and_test(&lli->lli_open_count)) {
+ CDEBUG(D_INFO, "last close, cancelling unused locks\n");
+ rc = obd_cancel_unused(ll_i2obdconn(inode), lsm, 0);
+ if (rc)
+ CERROR("obd_cancel_unused: %d\n", rc);
+ } else {
+ CDEBUG(D_INFO, "not last close, not cancelling unused locks\n");
+ }
EXIT;
return rc;
}
-
static inline void ll_remove_suid(struct inode *inode)
{
unsigned int mode;
struct ll_read_inode2_cookie lic;
class_uuid_t uuid;
-
/* Lprocfs variables */
char mnt_name[100];
char uuid_name[100];
struct lprocfs_vars d_vars[3];
-
-
ENTRY;
MOD_INC_USE_COUNT;
ptlrpc_req_finished(request);
request = NULL;
-
+
/* Register this mount instance with LProcFS */
-
+
snprintf(mnt_name, 100, "mount_%s", sbi->ll_sb_uuid);
sbi->ll_mnt_root=lprocfs_reg_mnt(mnt_name);
if(!sbi->ll_mnt_root)
goto out_dev;
/* Add the static configuration info */
- lprocfs_add_vars(sbi->ll_mnt_root,
+ lprocfs_add_vars(sbi->ll_mnt_root,
(struct lprocfs_vars*)status_var_nm_1,
(void*)sb);
/* Add the dynamic configuration stuff */
-
+
/* MDC */
obd = class_uuid2obd(mdc);
-
+
/* Reuse mnt_name */
-
+
sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name);
memset(d_vars, 0, sizeof(d_vars));
d_vars[0].read_fptr=rd_dev_name;
d_vars[0].write_fptr=0;
d_vars[0].name=(char*)mnt_name;
-
-
- snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
+
+
+ snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
obd->obd_type->typ_name);
d_vars[1].read_fptr=rd_dev_uuid;
d_vars[1].write_fptr=0;
d_vars[1].name=(char*)uuid_name;
-
- err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
+
+ err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
(void*)obd);
if (err) {
CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
}
-
+
/* OSC or LOV*/
obd = class_uuid2obd(osc);
/* Reuse mnt_name */
-
- snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name",
+
+ snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name",
obd->obd_type->typ_name);
memset(d_vars, 0, sizeof(d_vars));
d_vars[0].read_fptr=rd_dev_name;
d_vars[0].write_fptr=0;
d_vars[0].name=(char*)mnt_name;
-
-
- snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
+
+
+ snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
obd->obd_type->typ_name);
d_vars[1].read_fptr=rd_dev_uuid;
d_vars[1].write_fptr=0;
d_vars[1].name=(char*)uuid_name;
-
- err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
- (void*)obd);
+
+ err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
+ (void*)obd);
if (err) {
CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
}
rc = mdc_cancel_unused(&sbi->ll_mdc_conn, inode, LDLM_FL_NO_CALLBACK);
if (rc < 0) {
- CERROR("obd_cancel_unused: %d\n", rc);
+ CERROR("mdc_cancel_unused: %d\n", rc);
/* XXX FIXME do something dramatic */
}
ENTRY;
sema_init(&lli->lli_open_sem, 1);
+ atomic_set(&lli->lli_open_count, 0);
/* core attributes first */
ll_update_inode(inode, body);
GOTO(out_disc, rc);
}
rc = obd_iocontrol(IOC_OSC_REGISTER_LOV, &lov->tgts[i].conn,
- sizeof(struct obd_device *), obd, NULL);
+ sizeof(struct obd_device *), obd, NULL);
if (rc) {
CERROR("Target %s REGISTER_LOV error %d\n",
uuidarray[i], rc);
RETURN(rc);
}
-int lov_attach(struct obd_device *dev,
+int lov_attach(struct obd_device *dev,
obd_count len, void *data)
{
int rc;
- rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
+ rc = lprocfs_reg_obd(dev, (struct lprocfs_vars*)status_var_nm_1,
(void*)dev);
- return rc;
+ return rc;
}
int lov_detach(struct obd_device *dev)
-{
+{
int rc;
rc = lprocfs_dereg_obd(dev);
return rc;
-
+
}
struct obd_ops lov_obd_ops = {
static int __init lov_init(void)
{
int rc;
-
+
printk(KERN_INFO "Lustre Logical Object Volume driver " LOV_VERSION
", info@clusterfs.com\n");
lov_file_cache = kmem_cache_create("ll_lov_file_data",
rc = class_register_type(&lov_obd_ops,
(struct lprocfs_vars*)status_class_var,
OBD_LOV_DEVICENAME);
- if (rc) RETURN(rc);
-
- return 0;
+ if (rc)
+ RETURN(rc);
-
+ return 0;
}
static void __exit lov_exit(void)
{
-
if (kmem_cache_destroy(lov_file_cache))
CERROR("couldn't free LOV open cache\n");
class_unregister_type(OBD_LOV_DEVICENAME);
-
}
MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");