-header-guards-2.6-suse.patch
ext3-wantedi-2.6-suse.patch
ext3-san-jdike-2.6-suse.patch
iopen-2.6-suse.patch
ext3-ea-in-inode-2.6-suse.patch
export-ext3-2.6-suse.patch
ext3-include-fixes-2.6-suse.patch
-ext3-xattr-header-move-2.6.suse.patch
#define PORTAL_DEBUG
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
NAL_ENUM_END_MARKER
};
-#define PTL_NALFMT_SIZE 16
+#define PTL_NALFMT_SIZE 26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
#define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
#define PORTAL_DEBUG
+/* I think this beast is just trying to get cycles_t and get_cycles().
+ * this should be in its own header. */
#ifdef __linux__
# include <asm/types.h>
# if defined(__powerpc__) && !defined(__KERNEL__)
# include <asm/timex.h>
# undef __KERNEL__
# else
-# include <asm/timex.h>
+# if defined(__KERNEL__)
+# include <asm/timex.h>
+# else
+# include <sys/time.h>
+# define cycles_t unsigned long
+static inline cycles_t get_cycles(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (tv.tv_sec * 100000) + tv.tv_usec;
+}
+# endif
# endif
#else
# include <sys/types.h>
#endif
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#endif
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
#else
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt, ## a)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt, ## a)
#endif
#ifdef HAVE_PAGE_LIST
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
#endif
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
#endif
case TCPNAL:
/* userspace NAL */
case SOCKNAL:
- snprintf(str, PTL_NALFMT_SIZE-1,
- "%u:%d.%d.%d.%d", (__u32)(nid >> 32), HIPQUAD(nid));
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+ (__u32)(nid >> 32), HIPQUAD(nid));
break;
case QSWNAL:
case GMNAL:
case IBNAL:
case SCIMACNAL:
- snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+ (__u32)(nid >> 32), (__u32)nid);
break;
#endif
default:
- snprintf(str, PTL_NALFMT_SIZE-1, "(?%llx)", (long long)nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+ nal, (long long)nid);
+ break;
}
return str;
}
extern char portals_upcall[1024];
#define PSDEV_PORTALS (0x100)
-#define PSDEV_DEBUG 1 /* control debugging */
-#define PSDEV_SUBSYSTEM_DEBUG 2 /* control debugging */
-#define PSDEV_PRINTK 3 /* force all errors to console */
-#define PSDEV_CONSOLE 4 /* allow _any_ messages to console */
-#define PSDEV_DEBUG_PATH 5 /* crashdump log location */
-#define PSDEV_DEBUG_DUMP_PATH 6 /* crashdump tracelog location */
-#define PSDEV_PORTALS_UPCALL 7 /* User mode upcall script */
-
-#define PORTALS_PRIMARY_CTLCNT 7
-static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
+enum {
+ PSDEV_DEBUG = 1, /* control debugging */
+ PSDEV_SUBSYSTEM_DEBUG, /* control debugging */
+ PSDEV_PRINTK, /* force all errors to console */
+ PSDEV_CONSOLE, /* allow _any_ messages to console */
+ PSDEV_DEBUG_PATH, /* crashdump log location */
+ PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */
+ PSDEV_PORTALS_UPCALL, /* User mode upcall script */
+ PSDEV_PORTALS_MEMUSED, /* bytes currently PORTAL_ALLOCated */
+};
+
+static struct ctl_table portals_table[] = {
{PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
&proc_dointvec},
{PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
{PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
sizeof(portals_upcall), 0644, NULL, &proc_dostring,
&sysctl_string},
+ {PSDEV_PORTALS_MEMUSED, "memused", (int *)&portal_kmemory.counter,
+ sizeof(int), 0644, NULL, &proc_dointvec},
{0}
};
return 0;
}
-extern char *dump_filename;
-extern int dump(int dev_id, int opc, void *buf);
-
static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
{
if (!dump_filename) {
struct dump_hdr {
int magic;
int dev_id;
- int opc;
+ unsigned int opc;
};
char *dump_filename;
static int
-do_ioctl(int dev_id, int opc, void *buf)
+do_ioctl(int dev_id, unsigned int opc, void *buf)
{
int fd, rc;
* used, but for now it will assumed whatever app reads the file will
* know what to do. */
int
-dump(int dev_id, int opc, void *buf)
+dump(int dev_id, unsigned int opc, void *buf)
{
FILE *fp;
struct dump_hdr dump_hdr;
}
int
-l_ioctl(int dev_id, int opc, void *buf)
+l_ioctl(int dev_id, unsigned int opc, void *buf)
{
return current_ioc_handler(dev_id, opc, buf);
}
* each device used in the dump.
*/
int
-parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *))
+parse_dump(char * dump_file, ioc_handler_t ioc_func)
{
int line =0;
struct stat st;
case 4:
return ((__u32)nid);
default:
- fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %d\n", sizeof(nid));
+ fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %u\n", sizeof(nid));
abort();
/* notreached */
return (-1);
if (where == NULL)
return (-1);
- sprintf(whenstr, LPD64, e->lwte_when - t0);
+ sprintf(whenstr, LPU64, (__u64)(e->lwte_when - t0));
fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
#define CHECK_MEMBER_OFFSET(s,m) \
do { \
- CHECK_VALUE(offsetof(s, m)); \
+ CHECK_VALUE((int)offsetof(s, m)); \
} while (0)
#define CHECK_MEMBER_SIZEOF(s,m) \
* version 1.2.x
* bug fixes
- clear page cache after eviction (2766)
+ - deal with strange write() on x86-64 (3043)
+ - don't dereference NULL peer_ni in ldlm_handle_ast_error (3258)
tbd Cluster File Systems, Inc. <info@clusterfs.com>
* version 1.2.2
- zero nameidata in detach_mnt in 2.6 (3118)
- verify d_inode after revalidate_special is valid in 2.6 (3116)
- use lustre_put_super() to handle zconf unmounts in 2.6 (3064)
+ - initialize RPC timeout timer earlier for 2.6 (3219)
+ - don't dereference NULL reply buffer if mdc_close was never sent (2410)
+ - print nal/nid for unknown nid (3258)
* miscellania
- allow default OST striping configuration per directory (1414)
+ - increase maximum number of MDS request buffers for large systems
2004-03-22 Cluster File Systems, Inc. <info@clusterfs.com>
* version 1.2.1
#define MDT_MAX_THREADS 32UL
#define MDT_NUM_THREADS max(min_t(unsigned long, num_physpages / 8192, \
MDT_MAX_THREADS), 2UL)
-#define MDS_NBUF_MAX 512UL
+#define MDS_NBUF_MAX 4096UL
#define MDS_BUFSIZE (8 * 1024)
/* Assume file name length = FNAME_MAX = 256 (true for extN).
* path name length = PATH_MAX = 4096
unsigned int rq_intr:1, rq_replied:1, rq_err:1,
rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1,
rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
- rq_no_delay:1;
+ rq_no_delay:1, rq_net_err:1;
int rq_phase;
/* client-side refcount for SENT race */
atomic_t rq_refcount;
static inline char *ptlrpc_peernid2str(struct ptlrpc_peer *p, char *str)
{
+ LASSERT(p->peer_ni != NULL);
return (portals_nid2str(p->peer_ni->pni_number, p->peer_nid, str));
}
#define time_before(t1, t2) ((long)t2 - (long)t1 > 0)
#endif
+/* @max_age is the oldest time in jiffies that we accept using a cached data.
+ * If the cache is older than @max_age we will get a new value from the
+ * target. Use a value of "jiffies + HZ" to guarantee freshness. */
static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
if (time_before(obd->obd_osfs_age, max_age)) {
rc = OBP(obd, statfs)(obd, osfs, max_age);
- spin_lock(&obd->obd_osfs_lock);
- memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
- obd->obd_osfs_age = jiffies;
- spin_unlock(&obd->obd_osfs_lock);
+ if (rc == 0) {
+ spin_lock(&obd->obd_osfs_lock);
+ memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
+ obd->obd_osfs_age = jiffies;
+ spin_unlock(&obd->obd_osfs_lock);
+ }
} else {
CDEBUG(D_SUPER, "using cached obd_statfs data\n");
spin_lock(&obd->obd_osfs_lock);
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->dotdot;
-+ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
++ de = (struct ext3_dir_entry_2 *)&root->dotdot;
++ de = (struct ext3_dir_entry_2 *)((char *)de + le16_to_cpu(de->rec_len));
+ len = ((char *) root) + sb->s_blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (ext3_dirent *) data1;
-header-guards-2.6-suse.patch
ext3-wantedi-2.6-suse.patch
ext3-san-jdike-2.6-suse.patch
iopen-2.6-suse.patch
ext3-ea-in-inode-2.6-suse.patch
export-ext3-2.6-suse.patch
ext3-include-fixes-2.6-suse.patch
-ext3-xattr-header-move-2.6.suse.patch
obd->obd_recovery_handler = handler;
obd->obd_recovery_timer.function = target_recovery_expired;
obd->obd_recovery_timer.data = (unsigned long)obd;
- init_timer(&obd->obd_recovery_timer);
spin_unlock_bh(&obd->obd_processing_task_lock);
reset_recovery_timer(obd);
struct ptlrpc_connection *conn = lock->l_export->exp_connection;
char str[PTL_NALFMT_SIZE];
- CERROR("%s AST failed (%d) for res "LPU64"/"LPU64
- ", mode %s: evicting client %s@%s NID %s\n",
- ast_type, rc,
- lock->l_resource->lr_name.name[0],
- lock->l_resource->lr_name.name[1],
- ldlm_lockname[lock->l_granted_mode],
- lock->l_export->exp_client_uuid.uuid,
- conn->c_remote_uuid.uuid,
- ptlrpc_peernid2str(&conn->c_peer, str));
+ LDLM_ERROR(lock, "%s AST failed (%d): evicting client %s@%s NID "LPX64
+ " (%s)", ast_type, rc, lock->l_export->exp_client_uuid.uuid,
+ conn->c_remote_uuid.uuid, conn->c_peer.peer_nid,
+ ptlrpc_peernid2str(&conn->c_peer, str));
ptlrpc_fail_export(lock->l_export);
}
struct ptlrpc_request *req, int rc,
const char *ast_type)
{
+ struct ptlrpc_peer *peer = &req->rq_import->imp_connection->c_peer;
char str[PTL_NALFMT_SIZE];
if (rc == -ETIMEDOUT || rc == -EINTR || rc == -ENOTCONN) {
if (lock->l_export->exp_libclient) {
LDLM_DEBUG(lock, "%s AST to liblustre client (nid %s)"
" timeout, just cancelling lock", ast_type,
- ptlrpc_peernid2str(&req->rq_peer, str));
+ ptlrpc_peernid2str(peer, str));
ldlm_lock_cancel(lock);
rc = -ERESTART;
} else {
if (rc == -EINVAL)
LDLM_DEBUG(lock, "client (nid %s) returned %d"
" from %s AST - normal race",
- ptlrpc_peernid2str(&req->rq_peer, str),
+ ptlrpc_peernid2str(peer, str),
req->rq_repmsg->status, ast_type);
else
LDLM_ERROR(lock, "client (nid %s) returned %d "
- "from %s AST",
- ptlrpc_peernid2str(&req->rq_peer, str),
+ "from %s AST", ptlrpc_peernid2str(peer, str),
(req->rq_repmsg != NULL) ?
req->rq_repmsg->status : 0, ast_type);
ldlm_lock_cancel(lock);
case TCPNAL:
/* userspace NAL */
case SOCKNAL:
- sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
- HIPQUAD(nid));
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+ (__u32)(nid >> 32), HIPQUAD(nid));
break;
case QSWNAL:
case GMNAL:
case IBNAL:
case SCIMACNAL:
- sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+ (__u32)(nid >> 32), (__u32)nid);
break;
default:
- return NULL;
+ snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+ nal, (long long)nid);
+ break;
}
return str;
}
void init_current(char *comm)
-{
+{
current = malloc(sizeof(*current));
current->fs = malloc(sizeof(*current->fs));
current->fs->umask = umask(0777);
extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
-int lib_ioctl_nalcmd(int dev_id, int opc, void * ptr)
+int lib_ioctl_nalcmd(int dev_id, unsigned int opc, void * ptr)
{
struct portal_ioctl_data *ptldata;
return (0);
}
-int lib_ioctl(int dev_id, int opc, void * ptr)
+int lib_ioctl(int dev_id, unsigned int opc, void * ptr)
{
int rc;
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
#include <stdio.h>
#include <netinet/in.h>
#include <sys/socket.h>
unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
S_GMNAL | S_IBNAL);
-
+
void *inter_module_get(char *arg)
{
if (!strcmp(arg, "tcpnal_ni"))
case TCPNAL:
/* userspace NAL */
case SOCKNAL:
- sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
- HIPQUAD(nid));
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+ (__u32)(nid >> 32), HIPQUAD(nid));
break;
case QSWNAL:
case GMNAL:
case IBNAL:
case SCIMACNAL:
- sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+ (__u32)(nid >> 32), (__u32)nid);
break;
default:
- return NULL;
+ snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+ nal, (long long)nid);
+ break;
}
return str;
}
extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
-int liblustre_ioctl(int dev_id, int opc, void *ptr)
+int liblustre_ioctl(int dev_id, unsigned int opc, void *ptr)
{
int rc = -EINVAL;
.*.cmd
.*.flags
.tmp_versions
+.depend
struct config_llog_instance cfg;
int len;
- if (!lmd->lmd_mds) {
+ if (lmd->lmd_mds[0] == '\0') {
CERROR("no mds name\n");
GOTO(out_free, err = -EINVAL);
}
for (i = 0; i < oa_bufs; i++) {
int stripe = lov_stripe_number(lsm, pga[i].off);
int ost = lsm->lsm_oinfo[stripe].loi_ost_idx;
- struct ldlm_extent ext, subext;
- ext.start = pga[i].off;
- ext.end = pga[i].off + pga[i].count;
+ obd_off start, end;
- if (!lov_stripe_intersects(lsm, i, ext.start, ext.end,
- &subext.start, &subext.end))
+ if (!lov_stripe_intersects(lsm, i, pga[i].off,
+ pga[i].off + pga[i].count, &start,
+ &end))
continue;
if (lov->tgts[ost].active == 0) {
for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
i++, loi++, lov_lockhp++) {
ldlm_policy_data_t sub_ext;
+ obd_off start, end;
if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
- policy->l_extent.end,
- &sub_ext.l_extent.start,
- &sub_ext.l_extent.end))
+ policy->l_extent.end, &start,
+ &end))
continue;
+ sub_ext.l_extent.start = start;
+ sub_ext.l_extent.end = end;
sub_ext.l_extent.gid = policy->l_extent.gid;
if (lov->tgts[loi->loi_ost_idx].active == 0) {
for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count;
i++, loi++, lov_lockhp++) {
ldlm_policy_data_t sub_ext;
+ obd_off start, end;
int lov_flags;
if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
- policy->l_extent.end,
- &sub_ext.l_extent.start,
- &sub_ext.l_extent.end))
+ policy->l_extent.end, &start, &end))
continue;
+ sub_ext.l_extent.start = start;
+ sub_ext.l_extent.end = end;
+
if (lov->tgts[loi->loi_ost_idx].active == 0) {
CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
rc = -EIO;
NULL, NULL);
rc = l_wait_event(req->rq_reply_waitq, mdc_close_check_reply(req),
&lwi);
- if (rc == 0) {
- LASSERTF(req->rq_repmsg != NULL, "req = %p", req);
+ if (req->rq_repmsg == NULL) {
+ CDEBUG(D_HA, "request failed to send: %p, %d\n", req,
+ req->rq_status);
+ rc = req->rq_status;
+ } else if (rc == 0) {
rc = req->rq_repmsg->status;
if (req->rq_repmsg->type == PTL_RPC_MSG_ERR) {
DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
}
rc = ptlrpc_start_n_threads(obd, mds->mds_setattr_service,
- MDT_NUM_THREADS, "ll_mdt_attr");
+ MDT_NUM_THREADS, "ll_mdt_attr");
if (rc)
GOTO(err_thread2, rc);
cleanup_phase = 1; /* dchild, dparent, locks */
+ dget(dchild);
child_inode = dchild->d_inode;
if (child_inode == NULL) {
CDEBUG(D_INODE, "child doesn't exist (dir %lu, name %s)\n",
GOTO(cleanup, rc = -EISDIR);
}
- if (child_inode->i_nlink == (S_ISDIR(child_inode->i_mode) ? 2 : 1) &&
- mds_open_orphan_count(child_inode) > 0) {
- rc = mds_open_unlink_rename(rec, obd, dparent, dchild, &handle);
- cleanup_phase = 4; /* transaction */
- GOTO(cleanup, rc);
- }
-
/* Step 4: Do the unlink: we already verified ur_mode above (bug 72) */
switch (child_inode->i_mode & S_IFMT) {
case S_IFDIR:
switch(cleanup_phase) {
case 4:
+ LASSERT(dchild != NULL && dchild->d_inode != NULL);
+ LASSERT(atomic_read(&dchild->d_inode->i_count) > 0);
+ if (rc == 0 && dchild->d_inode->i_nlink == 0 &&
+ mds_open_orphan_count(dchild->d_inode) > 0) {
+ /* filesystem is really going to destroy an inode
+ * we have to delay this till inode is opened -bzzz */
+ mds_open_unlink_rename(rec, obd, dparent, dchild, NULL);
+ }
rc = mds_finish_transno(mds, dparent->d_inode, handle, req,
rc, 0);
if (!rc)
else
ptlrpc_save_lock(req, &parent_lockh, LCK_PW);
l_dput(dchild);
+ l_dput(dchild);
l_dput(dparent);
case 0:
break;
struct dentry *pending_child;
char fidname[LL_FID_NAMELEN];
int fidlen = 0, rc;
+ unsigned mode;
ENTRY;
LASSERT(!mds_inode_is_orphan(dchild->d_inode));
GOTO(out_dput, rc = 0);
}
- *handle = fsfilt_start(obd, pending_dir, FSFILT_OP_RENAME, NULL);
- if (IS_ERR(*handle))
- GOTO(out_dput, rc = PTR_ERR(*handle));
-
- lock_kernel();
- rc = vfs_rename(dparent->d_inode, dchild, pending_dir, pending_child);
- unlock_kernel();
+ /* link() is semanticaly-wrong for S_IFDIR, so we set S_IFREG
+ * for linking and return real mode back then -bzzz */
+ mode = dchild->d_inode->i_mode;
+ dchild->d_inode->i_mode = S_IFREG;
+ rc = vfs_link(dchild, pending_dir, pending_child);
if (rc)
- CERROR("error renaming orphan %lu/%s to PENDING: rc = %d\n",
- dparent->d_inode->i_ino, rec->ur_name, rc);
+ CERROR("error linking orphan %s to PENDING: rc = %d\n",
+ rec->ur_name, rc);
else
mds_inode_set_orphan(dchild->d_inode);
+
+ /* return mode and correct i_nlink if inode is directory */
+ LASSERT(dchild->d_inode->i_nlink == 1);
+ dchild->d_inode->i_mode = mode;
+ if ((mode & S_IFMT) == S_IFDIR) {
+ dchild->d_inode->i_nlink++;
+ pending_dir->i_nlink++;
+ }
+ mark_inode_dirty(dchild->d_inode);
+
out_dput:
dput(pending_child);
out_lock:
/* XXX belongs in setup not attach */
/* recovery data */
+ init_timer(&obd->obd_recovery_timer);
spin_lock_init(&obd->obd_processing_task_lock);
init_waitqueue_head(&obd->obd_next_transno_waitq);
INIT_LIST_HEAD(&obd->obd_recovery_queue);
OBD_FAIL_LOC = 1, /* control test failures instrumentation */
OBD_TIMEOUT, /* RPC timeout before recovery/intr */
OBD_UPCALL, /* path to recovery upcall */
+ OBD_MEMUSED, /* bytes currently OBD_ALLOCated */
OBD_SYNCFILTER, /* XXX temporary, as we play with sync osts.. */
};
/* XXX need to lock so we avoid update races with recovery upcall! */
{OBD_UPCALL, "upcall", obd_lustre_upcall, 128, 0644, NULL,
&proc_dostring, &sysctl_string },
+ {OBD_MEMUSED, "memused", (int *)&obd_memory.counter,
+ sizeof(int), 0644, NULL, &proc_dointvec},
{OBD_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int),
0644, NULL, &proc_dointvec},
{ 0 }
*.mod.c
.*.flags
.tmp_versions
+.depend
{
struct filter_export_data *fed;
struct obd_device *obd = exp->exp_obd;
+ static unsigned long last_msg;
+ static int last_count;
+ int mask = D_CACHE;
ENTRY;
LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
fed = &exp->exp_filter_data;
+ /* Don't print this to the console the first time it happens, since
+ * it can happen legitimately on occasion, but only rarely. */
+ if (time_after(jiffies, last_msg + 60 * HZ)) {
+ last_count = 0;
+ last_msg = jiffies;
+ }
+ if ((last_count & (-last_count)) == last_count)
+ mask = D_WARNING;
+ last_count++;
+
/* Add some margin, since there is a small race if other RPCs arrive
* out-or-order and have already consumed some grant. We want to
* leave this here in case there is a large error in accounting. */
- CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ?
- D_WARNING : D_CACHE,
+ CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ? mask:D_CACHE,
"%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n",
obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant,
oa->o_dropped, fed->fed_grant);
}
rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1,
- "ll_ost_create");
+ "ll_ost_creat");
if (rc)
GOTO(out_create, rc = -EINVAL);
#define PORTAL_DEBUG
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
NAL_ENUM_END_MARKER
};
-#define PTL_NALFMT_SIZE 16
+#define PTL_NALFMT_SIZE 26 /* %u:%u.%u.%u.%u (10+4+4+4+3+1) */
#define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
#define PORTAL_DEBUG
+/* I think this beast is just trying to get cycles_t and get_cycles().
+ * this should be in its own header. */
#ifdef __linux__
# include <asm/types.h>
# if defined(__powerpc__) && !defined(__KERNEL__)
# include <asm/timex.h>
# undef __KERNEL__
# else
-# include <asm/timex.h>
+# if defined(__KERNEL__)
+# include <asm/timex.h>
+# else
+# include <sys/time.h>
+# define cycles_t unsigned long
+static inline cycles_t get_cycles(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (tv.tv_sec * 100000) + tv.tv_usec;
+}
+# endif
# endif
#else
# include <sys/types.h>
#endif
#ifndef offsetof
-# define offsetof(typ,memb) ((int)((char *)&(((typ *)0)->memb)))
+# define offsetof(typ,memb) ((unsigned long)((char *)&(((typ *)0)->memb)))
#endif
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
#endif
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len,fmt"|%d", ## a,current->thread.mode.tt.extern_pid)
#else
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt, ## a)
+# define THREAD_NAME(comm, len, fmt, a...) \
+ snprintf(comm, len, fmt, ## a)
#endif
#ifdef HAVE_PAGE_LIST
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
-typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+typedef int (ioc_handler_t)(int dev_id, unsigned int opc, void *buf);
void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
-int l_ioctl(int dev_id, int opc, void *buf);
-int parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *));
+int l_ioctl(int dev_id, unsigned int opc, void *buf);
+int parse_dump(char * dump_file, ioc_handler_t ioc_func);
int jt_ioc_dump(int argc, char **argv);
+extern char *dump_filename;
+int dump(int dev_id, unsigned int opc, void *buf);
#endif
case TCPNAL:
/* userspace NAL */
case SOCKNAL:
- snprintf(str, PTL_NALFMT_SIZE-1,
- "%u:%d.%d.%d.%d", (__u32)(nid >> 32), HIPQUAD(nid));
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u.%u.%u.%u",
+ (__u32)(nid >> 32), HIPQUAD(nid));
break;
case QSWNAL:
case GMNAL:
case IBNAL:
case SCIMACNAL:
- snprintf(str, PTL_NALFMT_SIZE-1, LPD64, nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "%u:%u",
+ (__u32)(nid >> 32), (__u32)nid);
break;
#endif
default:
- snprintf(str, PTL_NALFMT_SIZE-1, "(?%llx)", (long long)nid);
+ snprintf(str, PTL_NALFMT_SIZE - 1, "?%d? %llx",
+ nal, (long long)nid);
+ break;
}
return str;
}
extern char portals_upcall[1024];
#define PSDEV_PORTALS (0x100)
-#define PSDEV_DEBUG 1 /* control debugging */
-#define PSDEV_SUBSYSTEM_DEBUG 2 /* control debugging */
-#define PSDEV_PRINTK 3 /* force all errors to console */
-#define PSDEV_CONSOLE 4 /* allow _any_ messages to console */
-#define PSDEV_DEBUG_PATH 5 /* crashdump log location */
-#define PSDEV_DEBUG_DUMP_PATH 6 /* crashdump tracelog location */
-#define PSDEV_PORTALS_UPCALL 7 /* User mode upcall script */
-
-#define PORTALS_PRIMARY_CTLCNT 7
-static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = {
+enum {
+ PSDEV_DEBUG = 1, /* control debugging */
+ PSDEV_SUBSYSTEM_DEBUG, /* control debugging */
+ PSDEV_PRINTK, /* force all errors to console */
+ PSDEV_CONSOLE, /* allow _any_ messages to console */
+ PSDEV_DEBUG_PATH, /* crashdump log location */
+ PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */
+ PSDEV_PORTALS_UPCALL, /* User mode upcall script */
+ PSDEV_PORTALS_MEMUSED, /* bytes currently PORTAL_ALLOCated */
+};
+
+static struct ctl_table portals_table[] = {
{PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL,
&proc_dointvec},
{PSDEV_SUBSYSTEM_DEBUG, "subsystem_debug", &portal_subsystem_debug,
{PSDEV_PORTALS_UPCALL, "upcall", portals_upcall,
sizeof(portals_upcall), 0644, NULL, &proc_dostring,
&sysctl_string},
+ {PSDEV_PORTALS_MEMUSED, "memused", (int *)&portal_kmemory.counter,
+ sizeof(int), 0644, NULL, &proc_dointvec},
{0}
};
return 0;
}
-extern char *dump_filename;
-extern int dump(int dev_id, int opc, void *buf);
-
static void applymask_all(unsigned int subs_mask, unsigned int debug_mask)
{
if (!dump_filename) {
struct dump_hdr {
int magic;
int dev_id;
- int opc;
+ unsigned int opc;
};
char *dump_filename;
static int
-do_ioctl(int dev_id, int opc, void *buf)
+do_ioctl(int dev_id, unsigned int opc, void *buf)
{
int fd, rc;
* used, but for now it will assumed whatever app reads the file will
* know what to do. */
int
-dump(int dev_id, int opc, void *buf)
+dump(int dev_id, unsigned int opc, void *buf)
{
FILE *fp;
struct dump_hdr dump_hdr;
}
int
-l_ioctl(int dev_id, int opc, void *buf)
+l_ioctl(int dev_id, unsigned int opc, void *buf)
{
return current_ioc_handler(dev_id, opc, buf);
}
* each device used in the dump.
*/
int
-parse_dump(char * dump_file, int (*ioc_func)(int dev_id, int opc, void *))
+parse_dump(char * dump_file, ioc_handler_t ioc_func)
{
int line =0;
struct stat st;
case 4:
return ((__u32)nid);
default:
- fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %d\n", sizeof(nid));
+ fprintf(stderr, "Unexpected sizeof(ptl_nid_t) == %u\n", sizeof(nid));
abort();
/* notreached */
return (-1);
if (where == NULL)
return (-1);
- sprintf(whenstr, LPD64, e->lwte_when - t0);
+ sprintf(whenstr, LPU64, (__u64)(e->lwte_when - t0));
fprintf(f, "%#010lx %#010lx %#010lx %#010lx: %#010lx %1d %10.6f %10.2f %s\n",
e->lwte_p1, e->lwte_p2, e->lwte_p3, e->lwte_p4,
#define CHECK_MEMBER_OFFSET(s,m) \
do { \
- CHECK_VALUE(offsetof(s, m)); \
+ CHECK_VALUE((int)offsetof(s, m)); \
} while (0)
#define CHECK_MEMBER_SIZEOF(s,m) \
DEBUG_REQ(D_NET, req, "REPLIED:");
GOTO(out, rc = 1);
}
+
+ if (req->rq_net_err && !req->rq_timedout) {
+ spin_unlock_irqrestore (&req->rq_lock, flags);
+ rc = ptlrpc_expire_one_request(req);
+ spin_lock_irqsave (&req->rq_lock, flags);
+ GOTO(out, rc);
+ }
if (req->rq_err) {
DEBUG_REQ(D_ERROR, req, "ABORTED:");
rc = ptl_send_rpc(req);
if (rc) {
DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
- req->rq_timeout = 1;
+ req->rq_net_err = 1;
RETURN(rc);
}
RETURN(0);
if (req->rq_phase == RQ_PHASE_INTERPRET)
GOTO(interpret, req->rq_status);
+ if (req->rq_net_err && !req->rq_timedout)
+ ptlrpc_expire_one_request(req);
+
if (req->rq_err) {
ptlrpc_unregister_reply(req);
if (req->rq_status == 0)
if (req->rq_waiting || req->rq_resend) {
int status;
- LASSERT (!ptlrpc_client_receiving_reply(req));
- LASSERT (req->rq_bulk == NULL ||
- !ptlrpc_bulk_active(req->rq_bulk));
-
spin_lock_irqsave(&imp->imp_lock, flags);
- if (ptlrpc_import_delay_req(imp, req, &status)) {
+ if (ptlrpc_import_delay_req(imp, req, &status)){
spin_unlock_irqrestore(&imp->imp_lock,
flags);
continue;
if (req->rq_bulk) {
__u64 old_xid = req->rq_xid;
+ ptlrpc_unregister_bulk (req);
+
/* ensure previous bulk fails */
req->rq_xid = ptlrpc_next_xid();
CDEBUG(D_HA, "resend bulk "
DEBUG_REQ(D_HA, req, "send failed (%d)",
rc);
force_timer_recalc = 1;
- req->rq_timeout = 0;
+ req->rq_net_err = 1;
}
/* need to reset the timeout */
force_timer_recalc = 1;
spin_lock_irqsave (&req->rq_lock, flags);
req->rq_resend = 1;
+ req->rq_net_err = 0;
req->rq_timedout = 0;
if (req->rq_bulk) {
__u64 old_xid = req->rq_xid;
* like failing sends in client.c does currently... */
spin_lock_irqsave(&req->rq_lock, flags);
- req->rq_timeout = 0;
+ req->rq_net_err = 1;
spin_unlock_irqrestore(&req->rq_lock, flags);
ptlrpc_wake_client_req(req);
request->rq_replied = 0;
request->rq_err = 0;
request->rq_timedout = 0;
+ request->rq_net_err = 0;
request->rq_resend = 0;
request->rq_restart = 0;
spin_unlock_irqrestore (&request->rq_lock, flags);
RECALC_SIGPENDING;
SIGNAL_MASK_UNLOCK(current, flags);
- THREAD_NAME(current->comm, "%s", data->name);
+ LASSERTF(strlen(data->name) < sizeof(current->comm),
+ "name %d > len %d\n",strlen(data->name),sizeof(current->comm));
+ THREAD_NAME(current->comm, sizeof(current->comm) - 1, "%s", data->name);
unlock_kernel();
/* Record that the thread is running */
SIGNAL_MASK_UNLOCK(current, flags);
spin_lock(&lcm->lcm_thread_lock);
- THREAD_NAME(current->comm, "ll_log_commit_%d",
- atomic_read(&lcm->lcm_thread_total));
+ THREAD_NAME(current->comm, sizeof(current->comm) - 1,
+ "ll_log_comt_%02d", atomic_read(&lcm->lcm_thread_total));
atomic_inc(&lcm->lcm_thread_total);
spin_unlock(&lcm->lcm_thread_lock);
unlock_kernel();
RECALC_SIGPENDING;
SIGNAL_MASK_UNLOCK(current, flags);
- THREAD_NAME(current->comm, "%s", data->name);
+ LASSERTF(strlen(data->name) < sizeof(current->comm),
+ "name %d > len %d\n",strlen(data->name),sizeof(current->comm));
+ THREAD_NAME(current->comm, sizeof(current->comm) - 1, "%s", data->name);
unlock_kernel();
/* Record that the thread is running */
spin_lock_irqsave(&svc->srv_lock, flags);
list_del(&thread->t_link);
spin_unlock_irqrestore(&svc->srv_lock, flags);
-
+
OBD_FREE(thread, sizeof(*thread));
}
spin_lock_irqsave(&svc->srv_lock, flags);
while (!list_empty(&svc->srv_threads)) {
- thread = list_entry(svc->srv_threads.next,
+ thread = list_entry(svc->srv_threads.next,
struct ptlrpc_thread, t_link);
spin_unlock_irqrestore(&svc->srv_lock, flags);
spin_unlock_irqrestore(&svc->srv_lock, flags);
}
+/* @base_name should be 12 characters or less - 3 will be added on */
int ptlrpc_start_n_threads(struct obd_device *dev, struct ptlrpc_service *svc,
int num_threads, char *base_name)
{
logs
ostactive
ll_dirstripe_verify
+openfilleddirunlink
noinst_PROGRAMS += opendirunlink opendevunlink unlinkmany fchdir_test checkstat
noinst_PROGRAMS += wantedi statone runas openfile getdents mkdirdeep o_directory
noinst_PROGRAMS += small_write multiop sleeptest ll_sparseness_verify
-noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify
+noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify openfilleddirunlink
# noinst_PROGRAMS += ldaptest
bin_PROGRAMS = mcreate munlink mkdirmany iopentest1 iopentest2
endif # TESTS
createtest_SOURCES = createtest.c
open_delay_SOURCES = open_delay.c
opendirunlink_SOURCES = opendirunlink.c
+openfilleddirunlink_SOURCES = openfilleddirunlink.c
opendevunlink_SOURCES = opendevunlink.c
fchdir_test_SOURCES = fchdir_test.c
getdents_SOURCES=getdents.c
if [ "$REPLAY_OST_SINGLE" != "no" ]; then
sh replay-ost-single.sh
fi
+
+if [ "$INSANITY" != "no" ]; then
+ sh insanity.sh -r
+fi
+++ /dev/null
-#!/bin/bash
-
-config=${1:-mount2.xml}
-
-SRCDIR=`dirname $0`
-PATH=$SRCDIR:$SRCDIR/../utils:$PATH
-LMC="${LMC:-lmc} -m $config"
-TMP=${TMP:-/tmp}
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=${MDSSIZE:-50000}
-MOUNT=${MOUNT:-/mnt/lustre}
-MOUNT1=${MOUNT1:-${MOUNT}1}
-MOUNT2=${MOUNT2:-${MOUNT}2}
-FSTYPE=${FSTYPE:-ext3}
-
-OSTDEV=${OSTDEV:-$TMP/ost1-`hostname`}
-OSTSIZE=${OSTSIZE:-200000}
-
-rm -f $config
-
-# create nodes
-${LMC} --add node --node localhost || exit 10
-${LMC} --add net --node localhost --nid localhost --nettype tcp || exit 11
-
-# configure mds server
-${LMC} --add mds --node localhost --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE || exit 20
-
-# configure ost
-${LMC} --add ost --node localhost --ost ost1 --fstype $FSTYPE --dev $OSTDEV --size $OSTSIZE || exit 30
-
-# create client config
-${LMC} --add mtpt --node localhost --path $MOUNT1 --mds mds1 --ost ost1 || exit 40
-${LMC} --add mtpt --node localhost --path $MOUNT2 --mds mds1 --ost ost1 || exit 40
+++ /dev/null
-#!/bin/bash
-
-config=${1:-mount2.xml}
-
-SRCDIR=`dirname $0`
-PATH=$SRCDIR:$SRCDIR/../utils:$PATH
-LMC="${LMC:-lmc} -m $config"
-TMP=${TMP:-/tmp}
-
-MDSDEV=${MDSDEV:-$TMP/mds1-`hostname`}
-MDSSIZE=${MDSSIZE:-50000}
-FSTYPE=${FSTYPE:-ext3}
-
-OSTDEV1=${OSTDEV1:-$TMP/ost1-`hostname`}
-OSTDEV2=${OSTDEV2:-$TMP/ost2-`hostname`}
-OSTDEV3=${OSTDEV3:-$TMP/ost3-`hostname`}
-OSTSIZE=${OSTSIZE:-100000}
-
-STRIPE_BYTES=65536
-STRIPES_PER_OBJ=2 # 0 means stripe over all OSTs
-
-rm -f $config
-
-# create nodes
-${LMC} --add net --node localhost --nid localhost --nettype tcp || exit 1
-
-# configure MDS server
-${LMC} --add mds --node localhost --mds mds1 --fstype $FSTYPE --dev $MDSDEV --size $MDSSIZE || exit 10
-
-# configure OSTs
-${LMC} --add lov --lov lov1 --mds mds1 --stripe_sz $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0 || exit 20
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV1 --size $OSTSIZE || exit 21
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV2 --size $OSTSIZE || exit 22
-${LMC} --add ost --node localhost --lov lov1 --fstype $FSTYPE --dev $OSTDEV3 --size $OSTSIZE || exit 23
-
-# create client config
-${LMC} --add mtpt --node localhost --path /mnt/lustre1 --mds mds1 --ost lov1 || exit 40
-${LMC} --add mtpt --node localhost --path /mnt/lustre2 --mds mds1 --ost lov1 || exit 41
exit(1);
}
break;
- case 'w':
- if (write(fd, "w", 1) == -1) {
+ case 'w': {
+ int rc;
+ if ((rc = write(fd, "w", 1)) == -1) {
perror("write");
exit(1);
}
+ /* b=3043 write() on Suse x86-64 is returning -errno
+ instead of -1, and not setting errno. */
+ if (rc < 0) {
+ fprintf(stderr, "MULTIOP: broken write() "
+ "returned %d, errno %d\n",
+ rc, errno);
+ exit(1);
+ }
break;
+ }
case 'W':
for (i = 0; i < mmap_len && mmap_ptr; i += 4096)
mmap_ptr[i] += junk++;
--- /dev/null
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+
+/* for O_DIRECTORY */
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <string.h>
+
+char fname[1024];
+
+
+int main(int argc, char **argv)
+{
+ char *dname1;
+ int fddir1, rc;
+ int fd;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s dirname1\n", argv[0]);
+ exit(1);
+ }
+
+ dname1 = argv[1];
+
+ //create the directory
+ fprintf(stderr, "creating directory %s\n", dname1);
+ rc = mkdir(dname1, 0744);
+ if (rc == -1) {
+ fprintf(stderr, "creating %s fails: %s\n",
+ dname1, strerror(errno));
+ exit(1);
+ }
+
+ sprintf(fname, "%s/0", dname1);
+ fprintf(stderr, "creating file %s\n", fname);
+ fd = creat(fname, 0666);
+ if (fd < 0) {
+ fprintf(stderr, "creation %s fails: %s\n",
+ fname, strerror(errno));
+ exit(1);
+ }
+ close(fd);
+
+ // open the dir again
+ fprintf(stderr, "opening directory\n");
+ fddir1 = open(dname1, O_RDONLY | O_DIRECTORY);
+ if (fddir1 == -1) {
+ fprintf(stderr, "open %s fails: %s\n",
+ dname1, strerror(errno));
+ exit(1);
+ }
+
+ // delete the dir
+ fprintf(stderr, "unlinking %s\n", dname1);
+ rc = rmdir(dname1);
+ if (rc == 0) {
+ fprintf(stderr, "unlinked non-empty %s successfully\n",
+ dname1);
+ exit(1);
+ }
+
+ if (access(dname1, F_OK) != 0){
+ fprintf(stderr, "can't access %s: %s\n",
+ dname1, strerror(errno));
+ exit(1);
+ }
+
+ fprintf(stderr, "Ok, everything goes well.\n");
+ return 0;
+}
# will get evicted here
do_facet client "cmp /etc/termcap $MOUNT/termcap" && return 1
sysctl -w lustre.fail_loc=0
+ # give recovery a chance to finish (shouldn't take long)
+ sleep 1
do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 2
}
run_test 16 "timeout bulk put, evict client (2732)"
cancel_lru_locks OSC
#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
do_facet ost sysctl -w lustre.fail_loc=0x80000308
- set -vx
kill -USR1 $MULTI_PID
wait $MULTI_PID
rc=$?
[ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
- set +vx
}
run_test 20a "ldlm_handle_enqueue error (should return error)"
sleep 1
rm -f $DIR/$tfile
touch $DIR/$tfile-2 || return 1
+ echo "pid: $pid will close"
kill -USR1 $pid
wait $pid || return 2
echo wait for MDS to timeout and recover
sleep $((TIMEOUT * 2))
unlinkmany $DIR/$tfile-%d 400 400
- $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
+ $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
}
run_test 42 "recovery after ost failure"
}
run_test 44 "race in target handle connect"
+# Handle failed close
+test_45() {
+ mdcdev=`awk '/mds_svc_MNT/ {print $1}' < /proc/fs/lustre/devices`
+ $LCTL --device $mdcdev recover
+
+ multiop $DIR/$tfile O_c &
+ pid=$!
+ sleep 1
+
+ # This will cause the CLOSE to fail before even
+ # allocating a reply buffer
+ $LCTL --device $mdcdev deactivate
+
+ # try the close
+ kill -USR1 $pid
+ wait $pid || return 1
+
+ $LCTL --device $mdcdev activate
+
+ $CHECKSTAT -t file $DIR/$tfile || return 2
+ return 0
+}
+run_test 45 "Handle failed close"
+
equals_msg test complete, cleaning up
$CLEANUP
}
run_test 31d "remove of open directory ========================="
+test_31e() {
+ openfilleddirunlink $DIR/d31e || error
+}
+run_test 31e "remove of open non-removable directory ========================="
+
test_32a() {
echo "== more mountpoints and symlinks ================="
[ -e $DIR/d32a ] && rm -fr $DIR/d32a
case S_MAGIC_ROMFS:
type = strdup("romfs");
break;
+ case S_MAGIC_LUSTRE:
+ type = strdup("lustre");
+ break;
#elif __GNU__
case FSTYPE_UFS:
type = strdup("ufs");
/* trick gcc into being unable to recognize the %c format so it doesn't
* issue its inane warning about %c and two-digit year representations. */
static size_t strftime_wrapper(char *s, size_t max, const char *fmt,
- struct tm *tm) {
+ struct tm *tm) {
return strftime(s, max, fmt, tm);
}
void print_human_time(time_t *t)
{
char str[40];
-
- if (strftime_wrapper(str, 40, "%c", localtime(t)) > 0)
+
+ if (strftime_wrapper(str, 40, "%c", localtime(t)) > 0)
printf(str);
- else
+ else
printf("Cannot calculate human readable time, sorry");
}
int rv;
unsigned int sbuflen = sizeof(sbuf);
#endif
-
+
switch(m) {
case 'n':
strcat(pformat, "s");
#define S_MAGIC_REISERFS 0x52654973
#define S_MAGIC_CRAMFS 0x28cd3d45
#define S_MAGIC_ROMFS 0x7275
+#define S_MAGIC_LUSTRE 0x0BD00BD0
#elif defined (__GNU__)
#include <hurd/hurd_types.h>
#endif
export LMC=${LMC:-"lmc"}
export LCTL=${LCTL:-"$LUSTRE/utils/lctl"}
export CHECKSTAT="${CHECKSTAT:-checkstat} "
+ export FSYTPE=${FSTYPE:-"ext3"}
# Paths on remote nodes, if different
export RLUSTRE=${RLUSTRE:-$LUSTRE}
shift
rm -f ${facet}active
add_facet $facet
- do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc $*
+ do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc --fstype $FSTYPE $*
}
add_mdsfailover() {
facet=$1
shift
add_facet ${facet}failover --lustre_upcall $UPCALL
- do_lmc --add mds --node ${facet}failover_facet --mds ${facet}_svc $*
+ do_lmc --add mds --node ${facet}failover_facet --mds ${facet}_svc --fstype $FSTYPE $*
}
add_ost() {
shift
rm -f ${facet}active
add_facet $facet
- do_lmc --add ost --node ${facet}_facet --ost ${facet}_svc $*
+ do_lmc --add ost --node ${facet}_facet --ost ${facet}_svc --fstype $FSTYPE $*
}
add_ostfailover() {
facet=$1
shift
add_facet ${facet}failover
- do_lmc --add ost --failover --node ${facet}failover_facet --ost ${facet}_svc $*
+ do_lmc --add ost --failover --node ${facet}failover_facet --ost ${facet}_svc --fstype $FSTYPE $*
}
add_lov() {
int
init_options(struct lustre_mount_data *lmd)
{
- memset(lmd, 0, sizeof(lmd));
+ memset(lmd, 0, sizeof(*lmd));
lmd->lmd_magic = LMD_MAGIC;
lmd->lmd_server_nid = PTL_NID_ANY;
lmd->lmd_local_nid = PTL_NID_ANY;
#define CHECK_MEMBER_OFFSET(s,m) \
do { \
- CHECK_VALUE(offsetof(struct s, m)); \
+ CHECK_VALUE((int)offsetof(struct s, m)); \
} while(0)
#define CHECK_MEMBER_SIZEOF(s,m) \