]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] InterMezzo maintainence patch
authorChen Yang <chyang@clusterfs.com>
Tue, 7 Oct 2003 02:15:15 +0000 (19:15 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 7 Oct 2003 02:15:15 +0000 (19:15 -0700)
I have tested these patches and can atteste that they work.

 - rwhron@earthlink.net:
include cleanup of fs/intermezzo
 - kdw@neowiz.com:
memory leakage problem,race condition report
 - Domen Puncer:
Use list_for_each() where applicable
 - Chen Yang:
include file modification for more platforms to compile intermezzo
fix an oops problem

22 files changed:
fs/intermezzo/cache.c
fs/intermezzo/dcache.c
fs/intermezzo/dir.c
fs/intermezzo/ext_attr.c
fs/intermezzo/file.c
fs/intermezzo/fileset.c
fs/intermezzo/inode.c
fs/intermezzo/journal.c
fs/intermezzo/journal_ext2.c
fs/intermezzo/journal_ext3.c
fs/intermezzo/journal_obdfs.c
fs/intermezzo/journal_reiserfs.c
fs/intermezzo/journal_tmpfs.c
fs/intermezzo/journal_xfs.c
fs/intermezzo/kml_utils.c
fs/intermezzo/methods.c
fs/intermezzo/presto.c
fs/intermezzo/psdev.c
fs/intermezzo/replicator.c
fs/intermezzo/super.c
fs/intermezzo/upcall.c
fs/intermezzo/vfs.c

index 02665709a0cd9ced788fd163595058d26126d96c..de49fe94c29932a1fb6a0bb039c7ab12b4a6a5ac 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 
index 9d62e7152667978b4717418cddaf2475560ffee3..8f8e2c516171556a5c5518c9dab73cfac705a5d2 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/fs.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
index ac6fe686e05ec9c1b365b581d5af15109632b5e4..d747fb8c80d4f20fb481255edf93a24518af081c 100644 (file)
  */
 
 #include <asm/bitops.h>
-#include <asm/ioctls.h>
+#include <asm/termios.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
-#include <linux/smp_lock.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -55,7 +54,7 @@ static inline void presto_relock_other(struct inode *dir)
 {
         /* vfs_mkdir locks */
         //        down(&dir->i_zombie);
-        lock_kernel(); 
+        //lock_kernel(); 
 }
 
 static inline void presto_fulllock(struct inode *dir) 
@@ -64,13 +63,13 @@ static inline void presto_fulllock(struct inode *dir)
         down(&dir->i_sem);
         /* vfs_mkdir locks */
         //        down(&dir->i_zombie);
-        lock_kernel(); 
+        //lock_kernel(); 
 }
 
 static inline void presto_unlock(struct inode *dir) 
 {
         /* vfs_mkdir locks */
-        unlock_kernel(); 
+        //unlock_kernel(); 
         //        up(&dir->i_zombie);
         /* the lock from sys_mkdir / lookup_create */
         up(&dir->i_sem);
index 14f0c4ca49d348fbe6064ecbcc3a73326ff3e27f..be91417c1db105aaa680c6da8f0fa58f6b031578 100644 (file)
 #include <linux/string.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/unistd.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
 #include <linux/fs.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <asm/segment.h>
index c8e6ab1166d971a3e8a3cb38ce10918de9e7e019..3bf995922199333cb6704527ab6240b85250d2c5 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/module.h>
index 615d37b6318e200a9dbd3c8dcec15f532a97639d..e0bb4c219a2a58ef53c1624da5209a9b23d8c120 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/module.h>
index f4721f1034a0c157d70c1b4f2c5fdd8a867632da..fda188bab541d86019eefa0a9c9f95ae8bd8fc0d 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/string.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/unistd.h>
 
 #include <asm/system.h>
index 3a077cf099a36da7fc34db56b2ce0ef7de3260a0..ca18696d8afb2dbec725b81f5bc2235bbb4e8bf2 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/vmalloc.h>
 #include <linux/time.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index 2adb47f8b676509724a45d6121861fcbf26922c5..d1cb293c21e63ea803ddb047072511c9463595f5 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index edaab249c916be71b1ee96f6bec917a607e024c5..b847b61983cdc3201f6d4e500a7a790fa5446f7f 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index 42f42285197965bef5ab24006db321774af012b1..702ee8b6478f9388d7ffa0d5493fb819757945b4 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index 2a1d6c8c21ce55204c3727838df7ba5cebfc04bd..93fc148452bb8ca0da2c58714e2ec2a7a77d3bd9 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index f2a81917cc490eec1b05fc84e77515d76b5decb0..4f3c463f0981f7a098c42e2e82f2badb4687f36c 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index c12d26552595197c24c3536d500d20f30f33e1e0..e065896c3db3839dc1849e22dc887205b749e091 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/vmalloc.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index ed0dd39b6d9208dd8654150440e15313fb802172..5062e2d71df58644bf157609e1e9475a1026c4c4 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/list.h>
 #include <linux/mm.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
index f6dc7bab3c8326fe67943a6fd74524212791ea49..8950efc8c2a34e79901daaee2c89049c34cdbb17 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/module.h>
index a843df4ef9040c124ef39c09852cbf2d3293ca91..d161a7ba694e4fe2d0c75bd7a0bdd35be7998c46 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/errno.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
-#include <linux/smp_lock.h>
 #include <asm/segment.h>
 #include <asm/uaccess.h>
 #include <linux/string.h>
index 3c25ec595ffed2479a87d873f4100d09cc574e1f..ec650c324e1985c90730e8e7b6c28282aebb1439 100644 (file)
@@ -102,8 +102,7 @@ int izo_psdev_setpid(int minor)
                 struct list_head *lh;
                 struct upc_req *req;
                 CERROR("WARNING: setpid & processing not empty!\n");
-                lh = &channel->uc_processing;
-                while ( (lh = lh->next) != &channel->uc_processing) {
+               list_for_each(lh, &channel->uc_processing) {
                         req = list_entry(lh, struct upc_req, rq_chain);
                         /* freeing of req and data is done by the sleeper */
                         wake_up(&req->rq_sleep);
@@ -208,8 +207,7 @@ static ssize_t presto_psdev_write(struct file *file, const char *buf,
 
         spin_lock(&channel->uc_lock); 
         /* Look for the message on the processing queue. */
-        lh  = &channel->uc_processing;
-        while ( (lh = lh->next) != &channel->uc_processing ) {
+       list_for_each(lh, &channel->uc_processing) {
                 tmp = list_entry(lh, struct upc_req , rq_chain);
                 if (tmp->rq_unique == hdr.unique) {
                         req = tmp;
@@ -337,8 +335,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
         /* Wake up clients so they can return. */
         CDEBUG(D_PSDEV, "Wake up clients sleeping for pending.\n");
         spin_lock(&channel->uc_lock); 
-        lh = &channel->uc_pending;
-        while ( (lh = lh->next) != &channel->uc_pending) {
+       list_for_each(lh, &channel->uc_pending) {
                 req = list_entry(lh, struct upc_req, rq_chain);
 
                 /* Async requests stay around for a new lento */
@@ -351,8 +348,7 @@ static int presto_psdev_release(struct inode * inode, struct file * file)
         }
 
         CDEBUG(D_PSDEV, "Wake up clients sleeping for processing\n");
-        lh = &channel->uc_processing;
-        while ( (lh = lh->next) != &channel->uc_processing) {
+       list_for_each(lh, &channel->uc_processing) {
                 req = list_entry(lh, struct upc_req, rq_chain);
                 /* freeing of req and data is done by the sleeper */
                 req->rq_flags |= REQ_DEAD; 
@@ -419,7 +415,7 @@ void presto_psdev_cleanup(void)
 
         for ( i = 0 ; i < MAX_CHANNEL ; i++ ) {
                 struct upc_channel *channel = &(izo_channels[i]);
-                struct list_head *lh;
+                struct list_head *lh, *next;
 
                 spin_lock(&channel->uc_lock); 
                 if ( ! list_empty(&channel->uc_pending)) { 
@@ -431,12 +427,10 @@ void presto_psdev_cleanup(void)
                 if ( ! list_empty(&channel->uc_cache_list)) { 
                         CERROR("Weird, tell Peter: module cleanup and cache listnot empty dev %d\n", i);
                 }
-                lh = channel->uc_pending.next;
-                while ( lh != &channel->uc_pending) {
+               list_for_each_safe(lh, next, &channel->uc_pending) {
                         struct upc_req *req;
 
                         req = list_entry(lh, struct upc_req, rq_chain);
-                        lh = lh->next;
                         if ( req->rq_flags & REQ_ASYNC ) {
                                 list_del(&(req->rq_chain));
                                 CDEBUG(D_UPCALL, "free pending upcall type %d\n",
@@ -448,8 +442,7 @@ void presto_psdev_cleanup(void)
                                 wake_up(&req->rq_sleep);
                         }
                 }
-                lh = &channel->uc_processing;
-                while ( (lh = lh->next) != &channel->uc_processing ) {
+               list_for_each(lh, &channel->uc_processing) {
                         struct upc_req *req;
                         req = list_entry(lh, struct upc_req, rq_chain);
                         list_del(&(req->rq_chain));
@@ -562,6 +555,10 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
         buffer->u_uniq = req->rq_unique;
         buffer->u_async = async;
 
+        /* Remove potential datarace possibility*/
+        if ( async ) 
+                req->rq_flags = REQ_ASYNC;
+
         spin_lock(&channel->uc_lock); 
         /* Append msg to pending queue and poke Lento. */
         list_add(&req->rq_chain, channel->uc_pending.prev);
@@ -574,7 +571,7 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
 
         if ( async ) {
                 /* req, rq_data are freed in presto_psdev_read for async */
-                req->rq_flags = REQ_ASYNC;
+                /* req->rq_flags = REQ_ASYNC;*/
                 EXIT;
                 return 0;
         }
@@ -645,5 +642,6 @@ int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer,
 exit_req:
         PRESTO_FREE(req, sizeof(struct upc_req));
 exit_buf:
+        PRESTO_FREE(buffer,*size);
         return error;
 }
index de70c8d69f9a1c6b51a25fe7c7131a36511fa01b..e7a0c5c17eabdb2a27cd052843a4dc52a7ba10e2 100644 (file)
@@ -97,11 +97,10 @@ izo_rep_cache_clean(struct presto_file_set *fset)
 struct izo_offset_rec *
 izo_rep_cache_find(struct presto_file_set *fset, char *uuid)
 {
-       struct list_head *buck = izo_rep_hash(fset->fset_clients, uuid);
-       struct list_head *tmp = buck;
+       struct list_head *tmp, *buck = izo_rep_hash(fset->fset_clients, uuid);
         struct izo_offset_rec *rec = NULL;
 
-        while ( (tmp = tmp->next) != buck ) {
+       list_for_each(tmp, buck) {
                rec = list_entry(tmp, struct izo_offset_rec, or_list);
                 if ( memcmp(rec->or_uuid, uuid, sizeof(rec->or_uuid)) == 0 )
                        return rec;
index 82104dd3093cf5003ed59f963569ea9face69394..9993ef2bf743ed648dcb908f3e8e44b1de05df3a 100644 (file)
@@ -38,7 +38,6 @@ static char rcsid[] __attribute ((unused)) = "$Id: super.c,v 1.4 2002/10/12 02:1
 #include <linux/sched.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
index df86732f0208efc766cdb00d2156b0413981f5bb..e8b6730a3ed7cfcf1ba268dd96c69d1061dae766 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/fs.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
-#include <linux/smp_lock.h>
 #include <linux/string.h>
 #include <asm/uaccess.h>
 
index 40b08d332d258d98aaf66f2e036eba25d71fe9a4..fa0159bab593083893c6ff348c45132ac1fd1708 100644 (file)
@@ -55,7 +55,6 @@
 
 #include <linux/mm.h>
 #include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
 #include <linux/quotaops.h>
 
 #include <asm/uaccess.h>