static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) { struct gfs2_holder t_gh; int error; gfs2_quota_sync(sdp); gfs2_statfs_sync(sdp); error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE, &t_gh); if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) return error; gfs2_meta_syncfs(sdp); gfs2_log_shutdown(sdp); clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); if (t_gh.gh_gl) gfs2_glock_dq_uninit(&t_gh); gfs2_quota_cleanup(sdp); return error; }
static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, size_t len) { if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (simple_strtol(buf, NULL, 0) != 1) return -EINVAL; gfs2_statfs_sync(sdp); return len; }
int gfs2_quotad(void *data) { struct gfs2_sbd *sdp = data; unsigned long t; int error; while (!kthread_should_stop()) { /* Update the master statfs file */ t = sdp->sd_statfs_sync_time + gfs2_tune_get(sdp, gt_statfs_quantum) * HZ; if (time_after_eq(jiffies, t)) { error = gfs2_statfs_sync(sdp); if (error && error != -EROFS && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) fs_err(sdp, "quotad: (1) error=%d\n", error); sdp->sd_statfs_sync_time = jiffies; } /* Update quota file */ t = sdp->sd_quota_sync_time + gfs2_tune_get(sdp, gt_quota_quantum) * HZ; if (time_after_eq(jiffies, t)) { error = gfs2_quota_sync(sdp); if (error && error != -EROFS && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) fs_err(sdp, "quotad: (2) error=%d\n", error); sdp->sd_quota_sync_time = jiffies; } gfs2_quota_scan(sdp); t = gfs2_tune_get(sdp, gt_quotad_secs) * HZ; if (freezing(current)) refrigerator(); schedule_timeout_interruptible(t); } return 0; }