# include <linux/signal.h>
# include <linux/types.h>
#endif
-#include <linux/portals_lib.h>
-#include <linux/kp30.h> /* XXX just for LASSERT! */
+#include <linux/kp30.h>
#include <linux/lustre_idl.h>
#include <linux/lustre_cfg.h>
int target_start_recovery_thread(struct obd_device *obd,
svc_handler_t handler);
void target_stop_recovery_thread(struct obd_device *obd);
+void target_cleanup_recovery(struct obd_device *obd);
int target_queue_recovery_request(struct ptlrpc_request *req,
struct obd_device *obd);
int target_queue_final_reply(struct ptlrpc_request *req, int rc);
int l_has_lock(struct lustre_lock *);
-#include <linux/portals_lib.h>
-
/*
* OBD IOCTLS
*/
static inline int obd_ioctl_is_invalid(struct obd_ioctl_data *data)
{
if (data->ioc_len > (1<<30)) {
- printk("LustreError: OBD ioctl: ioc_len larger than 1<<30\n");
+ CERROR("OBD ioctl: ioc_len larger than 1<<30\n");
return 1;
}
if (data->ioc_inllen1 > (1<<30)) {
- printk("LustreError: OBD ioctl: ioc_inllen1 larger than 1<<30\n");
+ CERROR("OBD ioctl: ioc_inllen1 larger than 1<<30\n");
return 1;
}
if (data->ioc_inllen2 > (1<<30)) {
- printk("LustreError: OBD ioctl: ioc_inllen2 larger than 1<<30\n");
+ CERROR("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
return 1;
}
if (data->ioc_inllen3 > (1<<30)) {
- printk("LustreError: OBD ioctl: ioc_inllen3 larger than 1<<30\n");
+ CERROR("OBD ioctl: ioc_inllen3 larger than 1<<30\n");
return 1;
}
if (data->ioc_inllen4 > (1<<30)) {
- printk("LustreError: OBD ioctl: ioc_inllen4 larger than 1<<30\n");
+ CERROR("OBD ioctl: ioc_inllen4 larger than 1<<30\n");
return 1;
}
if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
- printk("LustreError: OBD ioctl: inlbuf1 pointer but 0 length\n");
+ CERROR("OBD ioctl: inlbuf1 pointer but 0 length\n");
return 1;
}
if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
- printk("LustreError: OBD ioctl: inlbuf2 pointer but 0 length\n");
+ CERROR("OBD ioctl: inlbuf2 pointer but 0 length\n");
return 1;
}
if (data->ioc_inlbuf3 && !data->ioc_inllen3) {
- printk("LustreError: OBD ioctl: inlbuf3 pointer but 0 length\n");
+ CERROR("OBD ioctl: inlbuf3 pointer but 0 length\n");
return 1;
}
if (data->ioc_inlbuf4 && !data->ioc_inllen4) {
- printk("LustreError: OBD ioctl: inlbuf4 pointer but 0 length\n");
+ CERROR("OBD ioctl: inlbuf4 pointer but 0 length\n");
return 1;
}
if (data->ioc_pbuf1 && !data->ioc_plen1) {
- printk("LustreError: OBD ioctl: pbuf1 pointer but 0 length\n");
+ CERROR("OBD ioctl: pbuf1 pointer but 0 length\n");
return 1;
}
if (data->ioc_pbuf2 && !data->ioc_plen2) {
- printk("LustreError: OBD ioctl: pbuf2 pointer but 0 length\n");
+ CERROR("OBD ioctl: pbuf2 pointer but 0 length\n");
return 1;
}
if (data->ioc_plen1 && !data->ioc_pbuf1) {
- printk("LustreError: OBD ioctl: plen1 set but NULL pointer\n");
+ CERROR("OBD ioctl: plen1 set but NULL pointer\n");
return 1;
}
if (data->ioc_plen2 && !data->ioc_pbuf2) {
- printk("LustreError: OBD ioctl: plen2 set but NULL pointer\n");
+ CERROR("OBD ioctl: plen2 set but NULL pointer\n");
return 1;
}
if (obd_ioctl_packlen(data) != data->ioc_len) {
- printk("LustreError: OBD ioctl: packlen exceeds ioc_len (%d != %d)\n",
- obd_ioctl_packlen(data), data->ioc_len);
+ CERROR("OBD ioctl: packlen exceeds ioc_len (%d != %d)\n",
+ obd_ioctl_packlen(data), data->ioc_len);
return 1;
}
return 0;
}
if (hdr.ioc_len < sizeof(struct obd_ioctl_data)) {
- printk("LustreError: OBD: user buffer too small for ioctl\n");
+ CERROR("OBD: user buffer too small for ioctl\n");
return -EINVAL;
}
static inline int ll_insecure_random_int(void)
{
-#ifdef __arch_um__
struct timeval t;
do_gettimeofday(&t);
return (int)(t.tv_usec);
-#else
- return (int)(get_cycles() >> 2);
-#endif
}
/*
#else /* !__KERNEL__ */
#define __l_wait_event(wq, condition, info, ret, excl) \
do { \
+ int timeout = info->lwi_timeout, elapse; \
int __timed_out = 0; \
+ long last; \
\
+ last = time(NULL); \
for (;;) { \
if (condition) \
break; \
- if (liblustre_wait_event(info->lwi_timeout)) \
+ if (liblustre_wait_event(timeout)) { \
+ if (timeout == 0) \
+ continue; \
+ elapse = (int) (time(NULL) - last); \
+ if (elapse) { \
+ last += elapse; \
+ timeout -= elapse; \
+ if (timeout < 0) \
+ timeout = 0; \
+ } \
continue; \
+ } \
if (info->lwi_timeout && !__timed_out) { \
__timed_out = 1; \
if (info->lwi_on_timeout == NULL || \