+/*
+ * For old clients there is no direct way of knowing which filesystems
+ * a client is operating at the MGS side. But we need to pick up those
+ * clients so that the MGS can mark the corresponding filesystem as
+ * non-IR capable because old clients are not ready to be notified.
+ *
+ * This is why we have this _hack_ function. We detect the filesystem's
+ * name by hacking llog operation which is currently used by the clients
+ * to fetch configuration logs. At present this is fine because this is
+ * the ONLY llog operation between mgc and the MGS.
+ *
+ * If extra llog operation is going to be added, this function needs fixing.
+ *
+ * If releases prior than 2.0 are not supported, we can remove this function.
+ */
+static int mgs_handle_fslog_hack(struct ptlrpc_request *req)
+{
+ char *logname;
+ char fsname[16];
+ char *ptr;
+ int rc;
+
+ /* XXX: We suppose that llog at mgs is only used for
+ * fetching file system log */
+ logname = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+ if (logname == NULL) {
+ CERROR("No logname, is llog on MGS used for something else?\n");
+ return -EINVAL;
+ }
+
+ ptr = strchr(logname, '-');
+ rc = (int)(ptr - logname);
+ if (ptr == NULL || rc >= sizeof(fsname)) {
+ CERROR("Invalid logname received: %s\n", logname);
+ return -EINVAL;
+ }
+
+ strncpy(fsname, logname, rc);
+ fsname[rc] = 0;
+ rc = mgs_fsc_attach(req->rq_export, fsname);
+ if (rc < 0 && rc != -EEXIST)
+ CERROR("add fs client %s returns %d\n", fsname, rc);
+
+ return rc;
+}
+