- 2.6 changed lock ordering of 2 semaphores, caused deadlock (5654)
- don't start multiple acceptors for the same port (5277)
- fix incorrect LASSERT in mds_getattr_name (5635)
+ - fix "lfs check" to not block when the MDS is down, and export a proc
+ file for general "ping" checking (5628)
* miscellania
- service request history (4965)
- put {ll,lov,osc}_async_page structs in a single slab (4699)
int count, int *eof, void *data);
extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
unsigned long count, void *data);
+extern int lprocfs_wr_ping(struct file *file, const char *buffer,
+ unsigned long count, void *data);
/* Statfs helpers */
extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
{ return 0; }
static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
unsigned long count, void *data)
-{ return 0; };
+{ return 0; }
+static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{ return 0; }
/* Statfs helpers */
#define OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, long)
#define OBD_IOC_CLIENT_RECOVER _IOW ('f', 133, long)
-#define OBD_IOC_PING _IOWR('f', 135, long)
-
#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 139 )
#define OBD_IOC_NO_TRANSNO _IOW ('f', 140, long)
#define OBD_IOC_SET_READONLY _IOW ('f', 141, long)
extern int llapi_file_get_stripe(char *path, struct lov_user_md *lum);
extern int llapi_find(char *path, struct obd_uuid *obduuid, int recursive,
int verbose, int quiet);
+extern int llapi_ping(char *obd_type, char *obd_name);
extern int llapi_target_check(int num_types, char **obd_types, char *dir);
extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
putname(filename);
return rc;
}
- case OBD_IOC_PING: {
- struct ptlrpc_request *req = NULL;
- char *buf = NULL;
- int rc, len=0;
- struct client_obd *cli;
- struct obd_device *obd;
-
- rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
- if (rc)
- RETURN(rc);
- data = (void *)buf;
-
- obd = class_name2obd(data->ioc_inlbuf1);
-
- if (!obd )
- GOTO(out_ping, rc = -ENODEV);
-
- if (!obd->obd_attached) {
- CERROR("Device %d not attached\n", obd->obd_minor);
- GOTO(out_ping, rc = -ENODEV);
- }
- if (!obd->obd_set_up) {
- CERROR("Device %d still not setup\n", obd->obd_minor);
- GOTO(out_ping, rc = -ENODEV);
- }
- cli = &obd->u.cli;
- req = ptlrpc_prep_req(cli->cl_import, OBD_PING, 0, NULL, NULL);
- if (!req)
- GOTO(out_ping, rc = -ENOMEM);
-
- req->rq_replen = lustre_msg_size(0, NULL);
- req->rq_send_state = LUSTRE_IMP_FULL;
-
- rc = ptlrpc_queue_wait(req);
-
- ptlrpc_req_finished(req);
- out_ping:
- obd_ioctl_freedata(buf, len);
- return rc;
- }
case OBD_IOC_LLOG_CATINFO: {
struct ptlrpc_request *req = NULL;
char *buf = NULL;
#else
static struct lprocfs_vars lprocfs_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
+ { "ping", 0, lprocfs_wr_ping, 0 },
{ "blocksize", lprocfs_rd_blksize, 0, 0 },
{ "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
{ "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
static struct lprocfs_vars lprocfs_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
+ { "ping", 0, lprocfs_wr_ping, 0 },
{ "blocksize", lprocfs_rd_blksize, 0, 0 },
{ "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 },
{ "kbytesfree", lprocfs_rd_kbytesfree, 0, 0 },
return count;
}
EXPORT_SYMBOL(lprocfs_wr_evict_client);
+
+int lprocfs_wr_ping(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ struct ptlrpc_request *req;
+ int rc;
+ ENTRY;
+
+ req = ptlrpc_prep_req(obd->u.cli.cl_import, OBD_PING, 0, NULL, NULL);
+ if (req == NULL)
+ RETURN(-ENOMEM);
+
+ req->rq_replen = lustre_msg_size(0, NULL);
+ req->rq_send_state = LUSTRE_IMP_FULL;
+ req->rq_no_resend = 1;
+
+ rc = ptlrpc_queue_wait(req);
+
+ ptlrpc_req_finished(req);
+ if (rc >= 0)
+ RETURN(count);
+ RETURN(rc);
+}
+EXPORT_SYMBOL(lprocfs_wr_ping);
+
#endif /* LPROCFS */
#define MAX_STRING_SIZE 128
#define DEVICES_LIST "/proc/fs/lustre/devices"
+int llapi_ping(char *obd_type, char *obd_name)
+{
+ char path[MAX_STRING_SIZE];
+ char buf[1];
+ int rc, fd;
+
+ snprintf(path, MAX_STRING_SIZE, "/proc/fs/lustre/%s/%s/ping",
+ obd_type, obd_name);
+
+ fd = open(path, O_WRONLY);
+ if (fd < 0) {
+ fprintf(stderr, "error opening %s: %s\n", path, strerror(errno));
+ return errno;
+ }
+
+ rc = write(fd, buf, 1);
+ close(fd);
+
+ if (rc == 1)
+ return 0;
+ return rc;
+}
+
int llapi_target_check(int type_num, char **obd_type, char *dir)
{
char buf[MAX_STRING_SIZE];
FILE *fp = fopen(DEVICES_LIST, "r");
- int rc = 0;
- int i;
+ int i, rc = 0;
if (fp == NULL) {
fprintf(stderr, "error: %s opening "DEVICES_LIST"\n",
datal.ioc_pbuf1 = (char *)&osfs_buffer;
datal.ioc_plen1 = sizeof(osfs_buffer);
- for (i = 0; i < type_num; i++)
- if (strcmp(obd_type_name, obd_type[i]) == 0) {
- datal.ioc_inlbuf1 = obd_name;
- datal.ioc_inllen1 = strlen(obd_name) + 1;
-
- rc = obd_ioctl_pack(&datal, &bufl, OBD_MAX_IOCTL_BUFFER);
- if (rc) {
- fprintf(stderr, "internal buffer error packing\n");
- break;
- }
-
- rc = ioctl(dirfd(opendir(dir)), OBD_IOC_PING,
- bufl);
-
- if (rc) {
- fprintf(stderr, "error: check %s: %s\n",
- obd_name, strerror(rc = errno));
- } else {
- printf("%s active.\n",obd_name);
- }
- }
+ for (i = 0; i < type_num; i++) {
+ if (strcmp(obd_type_name, obd_type[i]) != 0)
+ continue;
+ rc = llapi_ping(obd_type_name, obd_name);
+ if (rc) {
+ fprintf(stderr, "error: check %s: %s\n",
+ obd_name, strerror(rc = errno));
+ } else {
+ printf("%s active.\n", obd_name);
+ }
+ }
}
fclose(fp);
return rc;
int rc;
sprintf(key, "%s", keyword);
- memset(raw, 0, sizeof(buf));
+ memset(raw, 0, sizeof(raw));
memset(out, 0, sizeof(out));
data.ioc_inlbuf1 = key;
data.ioc_inllen1 = strlen(key) + 1;