Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5fd7666
)
Put checks for LOV magic into LOV code, what a good idea.
author
adilger
<adilger>
Mon, 16 Sep 2002 22:46:35 +0000
(22:46 +0000)
committer
adilger
<adilger>
Mon, 16 Sep 2002 22:46:35 +0000
(22:46 +0000)
lustre/lov/lov_obd.c
patch
|
blob
|
history
diff --git
a/lustre/lov/lov_obd.c
b/lustre/lov/lov_obd.c
index
36d5226
..
9c54c6a
100644
(file)
--- a/
lustre/lov/lov_obd.c
+++ b/
lustre/lov/lov_obd.c
@@
-219,9
+219,10
@@
static int lov_create(struct lustre_handle *conn, struct obdo *oa,
ENTRY;
if (!ea) {
ENTRY;
if (!ea) {
- CERROR("lov_create needs
EA for striping information
\n");
+ CERROR("lov_create needs
ea
\n");
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+
if (!export)
RETURN(-EINVAL);
if (!export)
RETURN(-EINVAL);
@@
-315,6
+316,12
@@
static int lov_destroy(struct lustre_handle *conn, struct obdo *oa,
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
if (!export || !export->exp_obd)
RETURN(-ENODEV);
@@
-348,6
+355,12
@@
static int lov_getattr(struct lustre_handle *conn, struct obdo *oa,
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
if (!export || !export->exp_obd)
RETURN(-ENODEV);
@@
-408,10
+421,16
@@
static int lov_setattr(struct lustre_handle *conn, struct obdo *oa,
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
if (!export || !export->exp_obd)
RETURN(-ENODEV);
- if (oa->o_valid &
&
OBD_MD_FLSIZE)
+ if (oa->o_valid & OBD_MD_FLSIZE)
CERROR("setting size on an LOV object is totally broken\n");
lov = &export->exp_obd->u.lov;
CERROR("setting size on an LOV object is totally broken\n");
lov = &export->exp_obd->u.lov;
@@
-449,6
+468,12
@@
static int lov_open(struct lustre_handle *conn, struct obdo *oa,
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
if (!export || !export->exp_obd)
RETURN(-ENODEV);
@@
-495,6
+520,12
@@
static int lov_close(struct lustre_handle *conn, struct obdo *oa,
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
if (!export || !export->exp_obd)
RETURN(-ENODEV);
@@
-573,7
+604,13
@@
static int lov_punch(struct lustre_handle *conn, struct obdo *oa,
ENTRY;
if (!lsm) {
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for desctruction\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
@@
-647,6
+684,17
@@
static inline int lov_brw(int cmd, struct lustre_handle *conn,
int *where;
ENTRY;
int *where;
ENTRY;
+ if (!lsm) {
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
lov = &export->exp_obd->u.lov;
our_cb = ll_init_cb();
lov = &export->exp_obd->u.lov;
our_cb = ll_init_cb();
@@
-732,7
+780,13
@@
static int lov_enqueue(struct lustre_handle *conn, struct lov_stripe_md *lsm,
ENTRY;
if (!lsm) {
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for desctruction\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}
@@
-779,7
+833,13
@@
static int lov_cancel(struct lustre_handle *conn, struct lov_stripe_md *lsm,
ENTRY;
if (!lsm) {
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for lock cancellation\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
RETURN(-EINVAL);
}