[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lustre-cvs
Subject:    [Lustre-cvs] CVS: lustre/mds handler.c,1.187,1.188
From:       Andreas Dilger <adilger () users ! sourceforge ! net>
Date:       2002-10-31 7:39:19
[Download RAW message or body]

Update of /cvsroot/lustre/lustre/mds
In directory usw-pr-cvs1:/tmp/cvs-serv13186a/mds

Modified Files:
	handler.c 
Log Message:
Hack to force an MDS flush and also get the last_xid/last_committed from
the MDS, so the client can flush its pending RPC requests before umount.

Also, make mdc_statfs() into a OBD method, just because we can.


Index: handler.c
===================================================================
RCS file: /cvsroot/lustre/lustre/mds/handler.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -w -b -B -p -r1.187 -r1.188
--- handler.c	30 Oct 2002 21:59:59 -0000	1.187
+++ handler.c	31 Oct 2002 07:39:17 -0000	1.188
@@ -34,6 +34,7 @@
 #include <linux/init.h>
 #include <linux/obd_class.h>
 #include <linux/random.h>
+#include <linux/locks.h>
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
 #include <linux/buffer_head.h>
 #endif
@@ -396,6 +397,23 @@ static int mds_disconnect(struct lustre_
         RETURN(rc);
 }
 
+/*
+ * XXX This is NOT guaranteed to flush all transactions to disk (even though
+ *     it is equivalent to calling sync()) because it only _starts_ the flush
+ *     and does not wait for completion.  It's better than nothing though.
+ *     What we really want is a mild form of fsync_dev_lockfs(), but it is
+ *     non-standard, or enabling do_sync_supers in ext3, just for this call.
+ */
+static void mds_fsync_super(struct super_block *sb)
+{
+        lock_kernel();
+        lock_super(sb);
+        if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
+                sb->s_op->write_super(sb);
+        unlock_super(sb);
+        unlock_kernel();
+}
+
 static int mds_getstatus(struct ptlrpc_request *req)
 {
         struct mds_obd *mds = mds_req2mds(req);
@@ -410,7 +428,13 @@ static int mds_getstatus(struct ptlrpc_r
                 RETURN(0);
         }
 
-        /* Anything we need to do here with the client's trans no or so? */
+        /* Flush any outstanding transactions to disk so the client will
+         * get the latest last_committed value and can drop their local
+         * requests if they have any.  This would be fsync_super() if it
+         * was exported.
+         */
+        mds_fsync_super(mds->mds_sb);
+
         body = lustre_msg_buf(req->rq_repmsg, 0);
         memcpy(&body->fid1, &mds->mds_rootfid, sizeof(body->fid1));
 



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
Lustre-cvs mailing list
Lustre-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lustre-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic