Whamcloud - gitweb
LU-1715 ptlrpc: flock deadlock detection does not work
[fs/lustre-release.git] / lustre / obdclass / lprocfs_status.c
index 6544034..ec9e3b3 100644 (file)
@@ -62,12 +62,14 @@ EXPORT_SYMBOL(_lprocfs_lock);
 
 int lprocfs_single_release(struct inode *inode, struct file *file)
 {
+        LPROCFS_EXIT();
         return single_release(inode, file);
 }
 EXPORT_SYMBOL(lprocfs_single_release);
 
 int lprocfs_seq_release(struct inode *inode, struct file *file)
 {
+        LPROCFS_EXIT();
         return seq_release(inode, file);
 }
 EXPORT_SYMBOL(lprocfs_seq_release);
@@ -203,7 +205,7 @@ static ssize_t lprocfs_fops_read(struct file *f, char __user *buf,
         if (page == NULL)
                 return -ENOMEM;
 
-       if (LPROCFS_ENTRY_CHECK(dp)) {
+        if (LPROCFS_ENTRY_AND_CHECK(dp)) {
                 rc = -ENOENT;
                 goto out;
         }
@@ -212,6 +214,7 @@ static ssize_t lprocfs_fops_read(struct file *f, char __user *buf,
         if (dp->read_proc)
                rc = dp->read_proc(page, &start, *ppos, PAGE_CACHE_SIZE,
                                    &eof, dp->data);
+        LPROCFS_EXIT();
         if (rc <= 0)
                 goto out;
 
@@ -247,10 +250,11 @@ static ssize_t lprocfs_fops_write(struct file *f, const char __user *buf,
         struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode);
         int rc = -EIO;
 
-       if (LPROCFS_ENTRY_CHECK(dp))
+        if (LPROCFS_ENTRY_AND_CHECK(dp))
                 return -ENOENT;
         if (dp->write_proc)
                 rc = dp->write_proc(f, buf, size, dp->data);
+        LPROCFS_EXIT();
         return rc;
 }
 
@@ -772,7 +776,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
 {
        unsigned int                    num_entry;
        struct lprocfs_counter          *percpu_cntr;
-       struct lprocfs_counter_header   *cntr_header;
        int                             i;
        unsigned long                   flags = 0;
 
@@ -791,7 +794,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
        for (i = 0; i < num_entry; i++) {
                if (stats->ls_percpu[i] == NULL)
                        continue;
-               cntr_header = &stats->ls_cnt_header[idx];
                percpu_cntr = lprocfs_stats_counter_get(stats, i, idx);
 
                cnt->lc_count += percpu_cntr->lc_count;
@@ -880,6 +882,7 @@ static const char *obd_connect_names[] = {
        "lightweight_conn",
        "short_io",
        "pingless",
+       "flock_deadlock",
        "unknown",
         NULL
 };
@@ -1353,7 +1356,6 @@ EXPORT_SYMBOL(lprocfs_free_stats);
 void lprocfs_clear_stats(struct lprocfs_stats *stats)
 {
        struct lprocfs_counter          *percpu_cntr;
-       struct lprocfs_counter_header   *header;
        int                             i;
        int                             j;
        unsigned int                    num_entry;
@@ -1365,7 +1367,6 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats)
                if (stats->ls_percpu[i] == NULL)
                        continue;
                for (j = 0; j < stats->ls_num; j++) {
-                       header = &stats->ls_cnt_header[j];
                        percpu_cntr = lprocfs_stats_counter_get(stats, i, j);
                        percpu_cntr->lc_count           = 0;
                        percpu_cntr->lc_min             = LC_MIN_INIT;
@@ -1468,12 +1469,14 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file)
         struct seq_file *seq;
         int rc;
 
-       if (LPROCFS_ENTRY_CHECK(dp))
+        if (LPROCFS_ENTRY_AND_CHECK(dp))
                 return -ENOENT;
 
         rc = seq_open(file, &lprocfs_stats_seq_sops);
-       if (rc)
+        if (rc) {
+                LPROCFS_EXIT();
                 return rc;
+        }
         seq = file->private_data;
         seq->private = dp->data;
         return 0;