pstore/ram: Rate-limit "uncorrectable error in header" message
[linux-2.6-microblaze.git] / fs / fuse / control.c
index a1303ad..cc7e94d 100644 (file)
@@ -164,6 +164,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
 {
        unsigned val;
        struct fuse_conn *fc;
+       struct fuse_mount *fm;
        ssize_t ret;
 
        ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
@@ -174,18 +175,27 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file,
        if (!fc)
                goto out;
 
+       down_read(&fc->killsb);
        spin_lock(&fc->bg_lock);
        fc->congestion_threshold = val;
-       if (fc->sb) {
+
+       /*
+        * Get any fuse_mount belonging to this fuse_conn; s_bdi is
+        * shared between all of them
+        */
+
+       if (!list_empty(&fc->mounts)) {
+               fm = list_first_entry(&fc->mounts, struct fuse_mount, fc_entry);
                if (fc->num_background < fc->congestion_threshold) {
-                       clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC);
-                       clear_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC);
+                       clear_bdi_congested(fm->sb->s_bdi, BLK_RW_SYNC);
+                       clear_bdi_congested(fm->sb->s_bdi, BLK_RW_ASYNC);
                } else {
-                       set_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC);
-                       set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC);
+                       set_bdi_congested(fm->sb->s_bdi, BLK_RW_SYNC);
+                       set_bdi_congested(fm->sb->s_bdi, BLK_RW_ASYNC);
                }
        }
        spin_unlock(&fc->bg_lock);
+       up_read(&fc->killsb);
        fuse_conn_put(fc);
 out:
        return ret;