From bd1fc3e835b820dd627185001e21eee038c52f2f Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 18 Oct 2006 08:52:07 +0000 Subject: [PATCH] - various fixes from b1_5 --- lustre/llite/file.c | 3 +-- lustre/obdclass/obd_mount.c | 9 +++++++-- lustre/obdfilter/filter.c | 2 ++ lustre/obdfilter/filter_io_24.c | 2 ++ lustre/ptlrpc/pack_generic.c | 16 ++++++++++++---- lustre/utils/mkfs_lustre.c | 3 +-- lustre/utils/obd.c | 8 +++----- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 100f956..49cd749 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -510,8 +510,7 @@ int ll_file_open(struct inode *inode, struct file *file) } down(&lli->lli_och_sem); if (*och_p) { /* Open handle is present */ - if (it_disposition(it, DISP_LOOKUP_POS) && /* Positive lookup */ - it_disposition(it, DISP_OPEN_OPEN)) { /* & OPEN happened */ + if (it_disposition(it, DISP_OPEN_OPEN)) { /* Well, there's extra open request that we do not need, let's close it somehow. This will decref request. */ ll_release_openhandle(file->f_dentry, it); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index d4f8781..58c4672 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -1330,14 +1330,19 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb) mnt = do_kern_mount("ldiskfs", s_flags, lmd->lmd_dev, 0); if (IS_ERR(mnt)) { rc = PTR_ERR(mnt); - CERROR("premount ldiskfs failed (%d), trying ext3\n", rc); - /* If ldisk fails, try ext3 */ + CERROR("premount ldiskfs failed (%d), is the ldiskfs module " + "available?\n", rc); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + GOTO(out_free, rc); +#else + /* If ldiskfs fails, try ext3 */ mnt = do_kern_mount("ext3", s_flags, lmd->lmd_dev, 0); if (IS_ERR(mnt)) { rc = PTR_ERR(mnt); CERROR("premount ext3 failed: rc = %d\n", rc); GOTO(out_free, rc); } +#endif } OBD_SET_CTXT_MAGIC(&mount_ctxt); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 5fb77d9..8441532 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2819,6 +2819,7 @@ int filter_setattr_internal(struct obd_export *exp, struct dentry *dentry, } if (ia_valid & ATTR_SIZE || ia_valid & (ATTR_UID | ATTR_GID)) { + DQUOT_INIT(inode); LOCK_INODE_MUTEX(inode); locked = 1; } @@ -3492,6 +3493,7 @@ int filter_destroy(struct obd_export *exp, struct obdo *oa, if (fcc != NULL) memcpy(fcc, obdo_logcookie(oa), sizeof(*fcc)); } + DQUOT_INIT(dchild->d_inode); /* we're gonna truncate it first in order to avoid possible deadlock: * P1 P2 diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c index 314481b..a555477 100644 --- a/lustre/obdfilter/filter_io_24.c +++ b/lustre/obdfilter/filter_io_24.c @@ -455,6 +455,8 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); cleanup_phase = 2; + DQUOT_INIT(inode); + down(&inode->i_sem); oti->oti_handle = fsfilt_brw_start(obd, objcount, &fso, niocount, res, oti); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 9bd9388..47faddc 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -671,11 +671,11 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len) { int flipped, required_len, i; - required_len = lustre_msg_hdr_size_v2(m->lm_bufcount); + /* Now we know the sender speaks my language. */ + required_len = lustre_msg_hdr_size_v2(0); if (len < required_len) { - /* didn't receive all the buffer lengths */ - CERROR ("message length %d too small for %d buflens\n", - len, m->lm_bufcount); + /* can't even look inside the message */ + CERROR("message length %d too small for lustre_msg\n", len); return -EINVAL; } @@ -687,6 +687,14 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len) __swab32s(&m->lm_repsize); } + required_len = lustre_msg_hdr_size_v2(m->lm_bufcount); + if (len < required_len) { + /* didn't receive all the buffer lengths */ + CERROR ("message length %d too small for %d buflens\n", + len, m->lm_bufcount); + return -EINVAL; + } + for (i = 0; i < m->lm_bufcount; i++) { if (flipped) __swab32s(&m->lm_buflens[i]); diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 7f5ab64..3aca10f 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -1388,8 +1388,7 @@ int main(int argc, char *argv[]) if ((argc < 2) || (argv[argc - 1][0] == '-')) { usage(stderr); - ret = EINVAL; - goto out; + return(EINVAL); } memset(&mop, 0, sizeof(mop)); diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 6d8be40..ac9b251 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -159,12 +159,13 @@ int lcfg_mgs_ioctl(char *func, int dev_id, struct lustre_cfg *lcfg) { struct obd_ioctl_data data; static int mgs_device = -1; + char mgs[] = "$MGS"; int rc; /* Always operates on MGS dev */ if (mgs_device == -1) { do_disconnect(NULL, 1); - rc = do_device("mgsioc", "MGS"); + rc = do_device("mgsioc", mgs); if (rc) { errno = ENODEV; return -1; @@ -248,7 +249,7 @@ int parse_devname(char *func, char *name) rc = do_name2dev(func, name); if (rc >= N2D_OFF) { ret = rc - N2D_OFF; - printf("Name %s is device %d\n", name, ret); + // printf("Name %s is device %d\n", name, ret); } else { printf("No device found for name %s: %s\n", name, strerror(rc)); @@ -593,11 +594,8 @@ extern command_t cmdlist[]; static int do_device(char *func, char *devname) { - struct obd_ioctl_data data; int dev; - memset(&data, 0, sizeof(data)); - dev = parse_devname(func, devname); if (dev < 0) return -1; -- 1.8.3.1