b=17954
i=bobijam, deen
Coveirty fixes.
Author: Jim Garlick(LLNL).
13 files changed:
void ldlm_namespace_get_locked(struct ldlm_namespace *ns)
{
void ldlm_namespace_get_locked(struct ldlm_namespace *ns)
{
- LASSERT(ns->ns_refcount >= 0);
(struct ptlrpc_request *)
it->d.lustre.it_data);
} else {
(struct ptlrpc_request *)
it->d.lustre.it_data);
} else {
- struct file *filp;
-
- nd->intent.open.file->private_data = it;
- filp = lookup_instantiate_filp(nd, dentry,NULL);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
/* 2.6.1[456] have a bug in open_namei() that forgets to check
* nd->intent.open.file for error, so we need to return it as lookup's result
* instead */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
/* 2.6.1[456] have a bug in open_namei() that forgets to check
* nd->intent.open.file for error, so we need to return it as lookup's result
* instead */
+ struct file *filp;
+
+ nd->intent.open.file->private_data = it;
+ filp = lookup_instantiate_filp(nd, dentry,NULL);
+ if (IS_ERR(filp)) {
+ }
+#else
+ nd->intent.open.file->private_data = it;
+ (void)lookup_instantiate_filp(nd, dentry,NULL);
struct file *tail_filp, *first_filp, *second_filp;
struct ll_lock_tree first_tree, second_tree;
struct ll_lock_tree_node *first_node, *second_node;
struct file *tail_filp, *first_filp, *second_filp;
struct ll_lock_tree first_tree, second_tree;
struct ll_lock_tree_node *first_node, *second_node;
- struct ll_inode_info *hlli = ll_i2info(head), *tlli;
+ struct ll_inode_info *hlli = ll_i2info(head);
int rc = 0, cleanup_phase = 0;
ENTRY;
int rc = 0, cleanup_phase = 0;
ENTRY;
}
tail = igrab(tail_filp->f_dentry->d_inode);
}
tail = igrab(tail_filp->f_dentry->d_inode);
- tlli = ll_i2info(tail);
tail_dentry = tail_filp->f_dentry;
LASSERT(tail_dentry);
cleanup_phase = 1;
tail_dentry = tail_filp->f_dentry;
LASSERT(tail_dentry);
cleanup_phase = 1;
(struct ptlrpc_request *)
it->d.lustre.it_data);
} else {
(struct ptlrpc_request *)
it->d.lustre.it_data);
} else {
- struct file *filp;
- nd->intent.open.file->private_data = it;
- filp =lookup_instantiate_filp(nd,dentry,
- NULL);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
/* 2.6.1[456] have a bug in open_namei() that forgets to check
* nd->intent.open.file for error, so we need to return it as lookup's result
* instead */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
/* 2.6.1[456] have a bug in open_namei() that forgets to check
* nd->intent.open.file for error, so we need to return it as lookup's result
* instead */
+ struct file *filp;
+ nd->intent.open.file->private_data = it;
+ filp =lookup_instantiate_filp(nd,dentry,
+ NULL);
if (IS_ERR(filp)) {
if (de)
dput(de);
de = (struct dentry *) filp;
}
if (IS_ERR(filp)) {
if (de)
dput(de);
de = (struct dentry *) filp;
}
+#else
+ nd->intent.open.file->private_data = it;
+ (void)lookup_instantiate_filp(nd,dentry,
+ NULL);
unsigned long stride_len;
LASSERT(ras->ras_stride_length > 0);
unsigned long stride_len;
LASSERT(ras->ras_stride_length > 0);
+ LASSERTF(ras->ras_window_start + ras->ras_window_len
+ >= ras->ras_stride_offset, "window_start %lu, window_len %lu"
+ " stride_offset %lu\n", ras->ras_window_start,
+ ras->ras_window_len, ras->ras_stride_offset);
stride_len = ras->ras_window_start + ras->ras_window_len -
ras->ras_stride_offset;
stride_len = ras->ras_window_start + ras->ras_window_len -
ras->ras_stride_offset;
- LASSERTF(stride_len >= 0, "window_start %lu, window_len %lu"
- " stride_offset %lu\n", ras->ras_window_start,
- ras->ras_window_len, ras->ras_stride_offset);
-
left = stride_len % ras->ras_stride_length;
left = stride_len % ras->ras_stride_length;
window_len = ras->ras_window_len - left;
if (left < ras->ras_stride_pages)
window_len = ras->ras_window_len - left;
if (left < ras->ras_stride_pages)
struct obd_info oinfo;
struct lov_request *req;
struct list_head *pos;
struct obd_info oinfo;
struct lov_request *req;
struct list_head *pos;
- struct lov_obd *lov = &exp->exp_obd->u.lov;
struct lustre_handle *lov_lockhp;
int err = 0, rc = 0;
ENTRY;
struct lustre_handle *lov_lockhp;
int err = 0, rc = 0;
ENTRY;
GOTO(out, rc = -EINVAL);
/* If OST is inactive, return extent with UNKNOWN flag */
GOTO(out, rc = -EINVAL);
/* If OST is inactive, return extent with UNKNOWN flag */
- if (lov && !lov->lov_tgts[ost_index]->ltd_active) {
+ if (!lov->lov_tgts[ost_index]->ltd_active) {
fm_local->fm_flags |= FIEMAP_EXTENT_LAST;
fm_local->fm_mapped_extents = 1;
fm_local->fm_flags |= FIEMAP_EXTENT_LAST;
fm_local->fm_mapped_extents = 1;
if (strcmp(fed->fed_lcd->lcd_uuid, obd->obd_uuid.uuid ) == 0)
GOTO(free, 0);
if (strcmp(fed->fed_lcd->lcd_uuid, obd->obd_uuid.uuid ) == 0)
GOTO(free, 0);
- CDEBUG(D_INFO, "freeing client at idx %u, offset %lld with UUID '%s'\n",
- fed->fed_lr_idx, fed->fed_lr_off, fed->fed_lcd->lcd_uuid);
-
LASSERT(filter->fo_last_rcvd_slots != NULL);
off = fed->fed_lr_off;
LASSERT(filter->fo_last_rcvd_slots != NULL);
off = fed->fed_lr_off;
+ CDEBUG(D_INFO, "freeing client at idx %u, offset %lld with UUID '%s'\n",
+ fed->fed_lr_idx, fed->fed_lr_off, fed->fed_lcd->lcd_uuid);
+
/* Don't clear fed_lr_idx here as it is likely also unset. At worst
* we leak a client slot that will be cleaned on the next recovery. */
if (off <= 0) {
/* Don't clear fed_lr_idx here as it is likely also unset. At worst
* we leak a client slot that will be cleaned on the next recovery. */
if (off <= 0) {
struct obdo *saved_oa = NULL;
struct brw_page **ppga, **orig;
struct obd_import *imp = class_exp2cliimp(exp);
struct obdo *saved_oa = NULL;
struct brw_page **ppga, **orig;
struct obd_import *imp = class_exp2cliimp(exp);
- struct client_obd *cli = &imp->imp_obd->u.cli;
+ struct client_obd *cli;
int rc, page_count_orig;
ENTRY;
int rc, page_count_orig;
ENTRY;
+ LASSERT((imp != NULL) && (imp->imp_obd != NULL));
+ cli = &imp->imp_obd->u.cli;
+
if (cmd & OBD_BRW_CHECK) {
/* The caller just wants to know if there's a chance that this
* I/O can succeed */
if (cmd & OBD_BRW_CHECK) {
/* The caller just wants to know if there's a chance that this
* I/O can succeed */
- if (imp == NULL || imp->imp_invalid)
RETURN(-EIO);
RETURN(0);
}
RETURN(-EIO);
RETURN(0);
}
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
- char *fname, *mtpt, *pname;
char *fname_iname, *dir;
char *dir_iname = NULL, *foo = NULL, *bar = NULL;
int rc, fd, i, thread = 0;
int pidlist[10];
char *fname_iname, *dir;
char *dir_iname = NULL, *foo = NULL, *bar = NULL;
int rc, fd, i, thread = 0;
int pidlist[10];
- pname = strdup(argv[0]);
progname = basename(argv[0]);
if (argc != 2) {
progname = basename(argv[0]);
if (argc != 2) {
static int count = 1;
if (node->hit == 1) {
static int count = 1;
if (node->hit == 1) {
- dprintf("NODE "__S" has ever been accessed\n",
- __F(&n->in_extent));
+ error("A duplicate node "__S" access found\n",
+ __F(&n->in_extent));
return INTERVAL_ITER_CONT;
return INTERVAL_ITER_CONT;
- error("duplicate node accessing found\n");
- return INTERVAL_ITER_STOP;
}
if (node->valid == 0) {
}
if (node->valid == 0) {
+ memset(&st, 0, sizeof(st));
signal(SIGUSR1, usr1_handler);
fname = argv[1];
signal(SIGUSR1, usr1_handler);
fname = argv[1];
+ if (st.st_size == 0) {
+ fprintf(stderr, "mmap without preceeding stat, or on"
+ " zero length file.\n");
+ exit(-1);
+ }
mmap_len = st.st_size;
mmap_ptr = mmap(NULL, mmap_len, PROT_WRITE | PROT_READ,
MAP_SHARED, fd, 0);
mmap_len = st.st_size;
mmap_ptr = mmap(NULL, mmap_len, PROT_WRITE | PROT_READ,
MAP_SHARED, fd, 0);
maxrand *= 10;
gettimeofday(&start, NULL);
maxrand *= 10;
gettimeofday(&start, NULL);
while(!rc) {
if (usr1_received)
while(!rc) {
if (usr1_received)
printf("%s: %7ld files, %4ld MB in %.2fs (%7.2f files/s, "
"%5.2f MB/s): rc = %d\n",
cmdname, nfiles, nbytes >> 20, diff,
printf("%s: %7ld files, %4ld MB in %.2fs (%7.2f files/s, "
"%5.2f MB/s): rc = %d\n",
cmdname, nfiles, nbytes >> 20, diff,
- (double)nfiles / diff, (double)nbytes/1024/1024 / diff,
+ diff == 0 ? (double)0 : (double)nfiles / diff,
+ diff == 0 ? (double)0 : (double)nbytes/1024/1024 / diff,
lnet_nid_t nid;
converted = malloc(left);
lnet_nid_t nid;
converted = malloc(left);
+ if (converted == NULL) {
+ fprintf(stderr, "out of memory: needed %d bytes\n",
+ MAXNIDSTR);
+ return NULL;
+ }
c = converted;
while ((left > 0) && (*s1 != '/')) {
s2 = strpbrk(s1, ",:");
c = converted;
while ((left > 0) && (*s1 != '/')) {
s2 = strpbrk(s1, ",:");
glob_t glob_info;
struct stat stat_buf;
char *chk_major, *chk_minor;
glob_t glob_info;
struct stat stat_buf;
char *chk_major, *chk_minor;
- char *savept, *dev, *s2 = 0;
char *ret_path;
char buf[PATH_MAX] = {'\0'}, path[PATH_MAX] = {'\0'};
char real_path[PATH_MAX] = {'\0'};
char *ret_path;
char buf[PATH_MAX] = {'\0'}, path[PATH_MAX] = {'\0'};
char real_path[PATH_MAX] = {'\0'};
if (strncmp(real_path, "/dev/loop", 9) == 0)
return 0;
if (strncmp(real_path, "/dev/loop", 9) == 0)
return 0;
- if ((real_path[0] != '/') && ((s2 = strpbrk(real_path, ",:")) != NULL))
+ if ((real_path[0] != '/') && (strpbrk(real_path, ",:") != NULL))
return 0;
dev = real_path + src_len - 1;
return 0;
dev = real_path + src_len - 1;
}
usource = argv[optind];
}
usource = argv[optind];
+ if (!usource) {
+ usage(stderr);
+ }
+
source = convert_hostnames(usource);
source = convert_hostnames(usource);
+ if (!source) {
+ usage(stderr);
+ }
+
target = argv[optind + 1];
ptr = target + strlen(target) - 1;
while ((ptr > target) && (*ptr == '/')) {
target = argv[optind + 1];
ptr = target + strlen(target) - 1;
while ((ptr > target) && (*ptr == '/')) {
- if (!usource || !source) {
- usage(stderr);
- }
-
if (verbose) {
for (i = 0; i < argc; i++)
printf("arg[%d] = %s\n", i, argv[i]);
if (verbose) {
for (i = 0; i < argc; i++)
printf("arg[%d] = %s\n", i, argv[i]);
}
options = malloc(strlen(orig_options) + 1);
}
options = malloc(strlen(orig_options) + 1);
+ if (options == NULL) {
+ fprintf(stderr, "can't allocate memory for options\n");
+ return -1;
+ }
strcpy(options, orig_options);
rc = parse_options(options, &flags);
if (rc) {
strcpy(options, orig_options);
rc = parse_options(options, &flags);
if (rc) {
functions. So we'll stick it on the end of the options. */
optlen = strlen(options) + strlen(",device=") + strlen(source) + 1;
optcopy = malloc(optlen);
functions. So we'll stick it on the end of the options. */
optlen = strlen(options) + strlen(",device=") + strlen(source) + 1;
optcopy = malloc(optlen);
+ if (optcopy == NULL) {
+ fprintf(stderr, "can't allocate memory to optcopy\n");
+ return -1;
+ }
strcpy(optcopy, options);
if (*optcopy)
strcat(optcopy, ",");
strcpy(optcopy, options);
if (*optcopy)
strcat(optcopy, ",");