Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Revert "LU-147 avoid 8k obd device amount limit"
[fs/lustre-release.git]
/
lustre
/
obdclass
/
obd_config.c
diff --git
a/lustre/obdclass/obd_config.c
b/lustre/obdclass/obd_config.c
index
6b493c7
..
5e08e68
100644
(file)
--- a/
lustre/obdclass/obd_config.c
+++ b/
lustre/obdclass/obd_config.c
@@
-267,7
+267,7
@@
int class_attach(struct lustre_cfg *lcfg)
{
struct obd_device *obd = NULL;
char *typename, *name, *uuid;
- int rc;
+ int rc
, len
;
ENTRY;
if (!LUSTRE_CFG_BUFLEN(lcfg, 1)) {
@@
-288,16
+288,10
@@
int class_attach(struct lustre_cfg *lcfg)
}
uuid = lustre_cfg_string(lcfg, 2);
- if (strlen(uuid) >= sizeof(obd->obd_uuid)) {
- CERROR("uuid must be < %d bytes long\n",
- (int)sizeof(obd->obd_uuid));
- RETURN(-EINVAL);
- }
-
CDEBUG(D_IOCTL, "attach type %s name: %s uuid: %s\n",
MKSTR(typename), MKSTR(name), MKSTR(uuid));
- obd = class_newdev(typename, name
, uuid
);
+ obd = class_newdev(typename, name);
if (IS_ERR(obd)) {
/* Already exists or out of obds */
rc = PTR_ERR(obd);
@@
-306,7
+300,6
@@
int class_attach(struct lustre_cfg *lcfg)
name, typename, rc);
GOTO(out, rc);
}
-
LASSERTF(obd != NULL, "Cannot get obd device %s of type %s\n",
name, typename);
LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC,
@@
-346,6
+339,14
@@
int class_attach(struct lustre_cfg *lcfg)
llog_group_init(&obd->obd_olg, FID_SEQ_LLOG);
+ len = strlen(uuid);
+ if (len >= sizeof(obd->obd_uuid)) {
+ CERROR("uuid must be < %d bytes long\n",
+ (int)sizeof(obd->obd_uuid));
+ GOTO(out, rc = -EINVAL);
+ }
+ memcpy(obd->obd_uuid.uuid, uuid, len);
+
/* do the attach */
if (OBP(obd, attach)) {
rc = OBP(obd,attach)(obd, sizeof *lcfg, lcfg);
@@
-635,7
+636,10
@@
void class_decref(struct obd_device *obd, const char *scope, const void *source)
int err;
int refs;
- refs = cfs_atomic_dec_return(&obd->obd_refcount);
+ cfs_spin_lock(&obd->obd_dev_lock);
+ cfs_atomic_dec(&obd->obd_refcount);
+ refs = cfs_atomic_read(&obd->obd_refcount);
+ cfs_spin_unlock(&obd->obd_dev_lock);
lu_ref_del(&obd->obd_reference, scope, source);
CDEBUG(D_INFO, "Decref %s (%p) now %d\n", obd->obd_name, obd, refs);