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
- many gcc4 compilation fixes (warnings)
[fs/lustre-release.git]
/
lustre
/
lvfs
/
llog_lvfs.c
diff --git
a/lustre/lvfs/llog_lvfs.c
b/lustre/lvfs/llog_lvfs.c
index
938cfc3
..
3a9dd92
100644
(file)
--- a/
lustre/lvfs/llog_lvfs.c
+++ b/
lustre/lvfs/llog_lvfs.c
@@
-253,6
+253,7
@@
static int llog_lvfs_write_rec(struct llog_handle *loghandle,
loghandle->lgh_last_idx++;
index = loghandle->lgh_last_idx;
loghandle->lgh_last_idx++;
index = loghandle->lgh_last_idx;
+ LASSERT(index < LLOG_BITMAP_SIZE(llh));
rec->lrh_index = cpu_to_le32(index);
if (buf == NULL) {
lrt = (void *)rec + le32_to_cpu(rec->lrh_len) - sizeof(*lrt);
rec->lrh_index = cpu_to_le32(index);
if (buf == NULL) {
lrt = (void *)rec + le32_to_cpu(rec->lrh_len) - sizeof(*lrt);
@@
-516,12
+517,15
@@
llog_object_create_alone(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
LASSERT(lgh_id != NULL);
if (lgh_id->lgl_oid) {
struct dentry *dchild;
LASSERT(lgh_id != NULL);
if (lgh_id->lgl_oid) {
struct dentry *dchild;
- char
fidname[LL_F
ID_NAMELEN];
- int
fid
len = 0;
+ char
id_name[LL_
ID_NAMELEN];
+ int
id_
len = 0;
down(&ctxt->loc_objects_dir->d_inode->i_sem);
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- fidlen = ll_fid2str(fidname, lgh_id->lgl_oid, lgh_id->lgl_ogen);
- dchild = lookup_one_len(fidname, ctxt->loc_objects_dir, fidlen);
+ id_len = ll_id2str(id_name, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen);
+
+ dchild = lookup_one_len(id_name, ctxt->loc_objects_dir,
+ id_len);
if (IS_ERR(dchild)) {
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN((struct file *)dchild);
if (IS_ERR(dchild)) {
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN((struct file *)dchild);
@@
-560,8
+564,8
@@
llog_object_create_alone(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
RETURN(filp);
}
if (!S_ISREG(filp->f_dentry->d_inode->i_mode)) {
RETURN(filp);
}
if (!S_ISREG(filp->f_dentry->d_inode->i_mode)) {
- CERROR("%s is not a regular file!: mode = %o\n",
fidname,
- filp->f_dentry->d_inode->i_mode);
+ CERROR("%s is not a regular file!: mode = %o\n",
+
id_name,
filp->f_dentry->d_inode->i_mode);
filp_close(filp, 0);
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN(ERR_PTR(-ENOENT));
filp_close(filp, 0);
up(&ctxt->loc_objects_dir->d_inode->i_sem);
RETURN(ERR_PTR(-ENOENT));
@@
-572,13
+576,13
@@
llog_object_create_alone(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
} else {
unsigned int tmpname = ll_insecure_random_int();
} else {
unsigned int tmpname = ll_insecure_random_int();
- char
fidname[LL_F
ID_NAMELEN];
+ char
id_name[LL_
ID_NAMELEN];
struct dentry *new_child, *parent;
struct dentry *new_child, *parent;
+ int err, id_len;
void *handle;
void *handle;
- int err, namelen;
- sprintf(
fid
name, "OBJECTS/%u", tmpname);
- filp = filp_open(
fid
name, O_CREAT | O_EXCL, 0644);
+ sprintf(
id_
name, "OBJECTS/%u", tmpname);
+ filp = filp_open(
id_
name, O_CREAT | O_EXCL, 0644);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (rc == -EEXIST) {
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (rc == -EEXIST) {
@@
-590,11
+594,11
@@
llog_object_create_alone(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
RETURN(filp);
}
RETURN(filp);
}
-
namelen = ll_fid2str(fid
name, filp->f_dentry->d_inode->i_ino,
- filp->f_dentry->d_inode->i_generation);
+
id_len = ll_id2str(id_
name, filp->f_dentry->d_inode->i_ino,
+
filp->f_dentry->d_inode->i_generation);
parent = filp->f_dentry->d_parent;
down(&parent->d_inode->i_sem);
parent = filp->f_dentry->d_parent;
down(&parent->d_inode->i_sem);
- new_child = lookup_one_len(
fidname, parent, name
len);
+ new_child = lookup_one_len(
id_name, parent, id_
len);
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out_close, rc = PTR_ERR(new_child));
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out_close, rc = PTR_ERR(new_child));
@@
-656,8
+660,8
@@
llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
LASSERT(obd != NULL);
if (lgh_id->lgl_oid) {
LASSERT(obd != NULL);
if (lgh_id->lgl_oid) {
- dchild = obd_lvfs_
f
id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
-
lgh_id->lgl_ogen, lgh_id->lgl_ogr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen, lgh_id->lgl_ogr);
if (IS_ERR(dchild) == -ENOENT) {
OBD_ALLOC(oa, sizeof(*oa));
if (!oa)
if (IS_ERR(dchild) == -ENOENT) {
OBD_ALLOC(oa, sizeof(*oa));
if (!oa)
@@
-667,7
+671,7
@@
llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
oa->o_generation = lgh_id->lgl_ogen;
oa->o_gr = lgh_id->lgl_ogr;
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
oa->o_generation = lgh_id->lgl_ogen;
oa->o_gr = lgh_id->lgl_ogr;
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
- rc = obd_create(ctxt->loc_exp, oa, NULL, NULL);
+ rc = obd_create(ctxt->loc_exp, oa, NULL,
0, NULL,
NULL);
if (rc) {
CDEBUG(D_INODE, "err during create: %d\n", rc);
GOTO(out_free_oa, rc);
if (rc) {
CDEBUG(D_INODE, "err during create: %d\n", rc);
GOTO(out_free_oa, rc);
@@
-675,8
+679,8
@@
llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
CDEBUG(D_HA, "re-create log object "LPX64":0x%x:"LPX64"\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, lgh_id->lgl_ogr);
CDEBUG(D_HA, "re-create log object "LPX64":0x%x:"LPX64"\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, lgh_id->lgl_ogr);
- dchild = obd_lvfs_
f
id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
-
lgh_id->lgl_ogen, lgh_id->lgl_ogr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, lgh_id->lgl_oid,
+ lgh_id->lgl_ogen, lgh_id->lgl_ogr);
} else if (IS_ERR(dchild)) {
CERROR("error looking up logfile "LPX64":0x%x: rc %d\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, rc);
} else if (IS_ERR(dchild)) {
CERROR("error looking up logfile "LPX64":0x%x: rc %d\n",
lgh_id->lgl_oid, lgh_id->lgl_ogen, rc);
@@
-702,12
+706,12
@@
llog_object_create_generic(struct llog_ctxt *ctxt, struct llog_logid *lgh_id)
oa->o_gr = FILTER_GROUP_LLOG;
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
oa->o_gr = FILTER_GROUP_LLOG;
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
- rc = obd_create(ctxt->loc_exp, oa, NULL, NULL);
+ rc = obd_create(ctxt->loc_exp, oa, NULL,
0, NULL,
NULL);
if (rc)
GOTO(out_free_oa, rc);
if (rc)
GOTO(out_free_oa, rc);
- dchild = obd_lvfs_
f
id2dentry(ctxt->loc_exp, oa->o_id,
-
oa->o_generation, oa->o_gr);
+ dchild = obd_lvfs_id2dentry(ctxt->loc_exp, oa->o_id,
+ oa->o_generation, oa->o_gr);
if (IS_ERR(dchild))
GOTO(out_free_oa, rc = PTR_ERR(dchild));
if (IS_ERR(dchild))
GOTO(out_free_oa, rc = PTR_ERR(dchild));
@@
-746,14
+750,14
@@
static int llog_add_link_object(struct llog_ctxt *ctxt, struct llog_logid logid,
struct dentry *dentry)
{
struct dentry *new_child;
struct dentry *dentry)
{
struct dentry *new_child;
- char
fidname[LL_F
ID_NAMELEN];
+ char
id_name[LL_
ID_NAMELEN];
void *handle;
void *handle;
- int
name
len, rc = 0, err;
+ int
id_
len, rc = 0, err;
ENTRY;
ENTRY;
-
namelen = ll_fid2str(fid
name, logid.lgl_oid, logid.lgl_ogen);
+
id_len = ll_id2str(id_
name, logid.lgl_oid, logid.lgl_ogen);
down(&ctxt->loc_objects_dir->d_inode->i_sem);
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- new_child = lookup_one_len(
fidname, ctxt->loc_objects_dir, name
len);
+ new_child = lookup_one_len(
id_name, ctxt->loc_objects_dir, id_
len);
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out, rc = PTR_ERR(new_child));
if (IS_ERR(new_child)) {
CERROR("getting neg dentry for obj rename: %d\n", rc);
GOTO(out, rc = PTR_ERR(new_child));
@@
-773,9
+777,14
@@
static int llog_add_link_object(struct llog_ctxt *ctxt, struct llog_logid logid,
lock_kernel();
rc = vfs_link(dentry, ctxt->loc_objects_dir->d_inode, new_child);
unlock_kernel();
lock_kernel();
rc = vfs_link(dentry, ctxt->loc_objects_dir->d_inode, new_child);
unlock_kernel();
- if (rc)
- CERROR("error link new object "LPX64":%
u
: rc %d\n",
+ if (rc)
{
+ CERROR("error link new object "LPX64":%
08x
: rc %d\n",
logid.lgl_oid, logid.lgl_ogen, rc);
logid.lgl_oid, logid.lgl_ogen, rc);
+ /* it doesn't make much sense to get -EEXIST here */
+ LASSERTF(rc != -EEXIST, "bug 3490: dentry: %p "
+ "dir->d_ionode %p new_child: %p \n",
+ dentry, ctxt->loc_objects_dir->d_inode, new_child);
+ }
err = llog_fsfilt_commit(ctxt, ctxt->loc_objects_dir->d_inode, handle, 0);
out_dput:
l_dput(new_child);
err = llog_fsfilt_commit(ctxt, ctxt->loc_objects_dir->d_inode, handle, 0);
out_dput:
l_dput(new_child);
@@
-867,9
+876,9
@@
static int llog_lvfs_destroy(struct llog_handle *loghandle)
struct lvfs_run_ctxt saved;
struct dentry *fdentry;
struct inode *parent_inode;
struct lvfs_run_ctxt saved;
struct dentry *fdentry;
struct inode *parent_inode;
- char
fidname[LL_F
ID_NAMELEN];
+ char
id_name[LL_
ID_NAMELEN];
void *handle;
void *handle;
- int rc = -EINVAL, err,
name
len;
+ int rc = -EINVAL, err,
id_
len;
ENTRY;
if (ctxt->loc_lvfs_ctxt)
ENTRY;
if (ctxt->loc_lvfs_ctxt)
@@
-878,11
+887,11
@@
static int llog_lvfs_destroy(struct llog_handle *loghandle)
fdentry = loghandle->lgh_file->f_dentry;
parent_inode = fdentry->d_parent->d_inode;
fdentry = loghandle->lgh_file->f_dentry;
parent_inode = fdentry->d_parent->d_inode;
- if (!strcmp(fdentry->d_parent->d_name.name, "LOGS")) {
+ if (!strcmp(
(char *)
fdentry->d_parent->d_name.name, "LOGS")) {
LASSERT(parent_inode == ctxt->loc_logs_dir->d_inode);
LASSERT(parent_inode == ctxt->loc_logs_dir->d_inode);
-
namelen = ll_fid2str(fid
name, fdentry->d_inode->i_ino,
-
fdentry->d_inode->i_generation);
+
id_len = ll_id2str(id_
name, fdentry->d_inode->i_ino,
+ fdentry->d_inode->i_generation);
dget(fdentry);
rc = llog_lvfs_close(loghandle);
if (rc) {
dget(fdentry);
rc = llog_lvfs_close(loghandle);
if (rc) {
@@
-904,10
+913,11
@@
static int llog_lvfs_destroy(struct llog_handle *loghandle)
if (!rc) {
down(&ctxt->loc_objects_dir->d_inode->i_sem);
if (!rc) {
down(&ctxt->loc_objects_dir->d_inode->i_sem);
- fdentry = lookup_one_len(
fid
name, ctxt->loc_objects_dir,
-
name
len);
+ fdentry = lookup_one_len(
id_
name, ctxt->loc_objects_dir,
+
id_
len);
if (fdentry == NULL || fdentry->d_inode == NULL) {
if (fdentry == NULL || fdentry->d_inode == NULL) {
- CERROR("destroy non_existent object %s\n", fidname);
+ CERROR("destroy non_existent object %s\n",
+ id_name);
GOTO(out_err, rc = IS_ERR(fdentry) ?
PTR_ERR(fdentry) : -ENOENT);
}
GOTO(out_err, rc = IS_ERR(fdentry) ?
PTR_ERR(fdentry) : -ENOENT);
}
@@
-923,7
+933,7
@@
out_err:
GOTO(out, rc);
}
if (ctxt->loc_alone) {
GOTO(out, rc);
}
if (ctxt->loc_alone) {
- if (!strcmp(fdentry->d_parent->d_name.name, "OBJECTS")) {
+ if (!strcmp(
(char *)
fdentry->d_parent->d_name.name, "OBJECTS")) {
LASSERT(parent_inode == ctxt->loc_objects_dir->d_inode);
dget(fdentry);
LASSERT(parent_inode == ctxt->loc_objects_dir->d_inode);
dget(fdentry);
@@
-963,7
+973,7
@@
out:
/* reads the catalog list */
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
/* reads the catalog list */
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, c
onst c
har *name,
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
@@
-1008,7
+1018,7
@@
EXPORT_SYMBOL(llog_get_cat_list);
/* writes the cat list */
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
/* writes the cat list */
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, c
onst c
har *name,
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
int count, struct llog_catid *idarray)
{
struct lvfs_run_ctxt saved;
@@
-1099,7
+1109,7
@@
static int llog_lvfs_destroy(struct llog_handle *handle)
}
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
}
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, c
onst c
har *name,
int count, struct llog_catid *idarray)
{
LBUG();
int count, struct llog_catid *idarray)
{
LBUG();
@@
-1107,7
+1117,7
@@
int llog_get_cat_list(struct lvfs_run_ctxt *ctxt,
}
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
}
int llog_put_cat_list(struct lvfs_run_ctxt *ctxt,
- struct fsfilt_operations *fsops, char *name,
+ struct fsfilt_operations *fsops, c
onst c
har *name,
int count, struct llog_catid *idarray)
{
LBUG();
int count, struct llog_catid *idarray)
{
LBUG();