Skip to content

Commit de3f906

Browse files
author
Andreas Gruenbacher
committed
gfs2: Revert 'Fix "truncate in progress" hang'
Now that interrupted truncates are completed in the context of the process taking the glock, there is no need for the glock state engine to delegate that task to gfs2_quotad or for quotad to perform those truncates anymore. Get rid of the obsolete associated infrastructure. Reverts commit 813e0c4 ("GFS2: Fix "truncate in progress" hang"). Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Bob Peterson <[email protected]>
1 parent 53d6913 commit de3f906

File tree

7 files changed

+8
-80
lines changed

7 files changed

+8
-80
lines changed

fs/gfs2/glock.c

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ int gfs2_instantiate(struct gfs2_holder *gh)
518518
* do_promote - promote as many requests as possible on the current queue
519519
* @gl: The glock
520520
*
521-
* Returns: 1 if there is a blocked holder at the head of the list, or 2
522-
* if a type specific operation is underway.
521+
* Returns: 1 if there is a blocked holder at the head of the list
523522
*/
524523

525524
static int do_promote(struct gfs2_glock *gl)
@@ -627,7 +626,6 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
627626
const struct gfs2_glock_operations *glops = gl->gl_ops;
628627
struct gfs2_holder *gh;
629628
unsigned state = ret & LM_OUT_ST_MASK;
630-
int rv;
631629

632630
spin_lock(&gl->gl_lockref.lock);
633631
trace_gfs2_glock_state_change(gl, state);
@@ -685,6 +683,8 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
685683
gfs2_demote_wake(gl);
686684
if (state != LM_ST_UNLOCKED) {
687685
if (glops->go_xmote_bh) {
686+
int rv;
687+
688688
spin_unlock(&gl->gl_lockref.lock);
689689
rv = glops->go_xmote_bh(gl);
690690
spin_lock(&gl->gl_lockref.lock);
@@ -693,13 +693,10 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
693693
goto out;
694694
}
695695
}
696-
rv = do_promote(gl);
697-
if (rv == 2)
698-
goto out_locked;
696+
do_promote(gl);
699697
}
700698
out:
701699
clear_bit(GLF_LOCK, &gl->gl_flags);
702-
out_locked:
703700
spin_unlock(&gl->gl_lockref.lock);
704701
}
705702

@@ -856,7 +853,6 @@ __releases(&gl->gl_lockref.lock)
856853
__acquires(&gl->gl_lockref.lock)
857854
{
858855
struct gfs2_holder *gh = NULL;
859-
int ret;
860856

861857
if (test_and_set_bit(GLF_LOCK, &gl->gl_flags))
862858
return;
@@ -875,18 +871,14 @@ __acquires(&gl->gl_lockref.lock)
875871
} else {
876872
if (test_bit(GLF_DEMOTE, &gl->gl_flags))
877873
gfs2_demote_wake(gl);
878-
ret = do_promote(gl);
879-
if (ret == 0)
874+
if (do_promote(gl) == 0)
880875
goto out_unlock;
881-
if (ret == 2)
882-
goto out;
883876
gh = find_first_waiter(gl);
884877
gl->gl_target = gh->gh_state;
885878
if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
886879
do_error(gl, 0); /* Fail queued try locks */
887880
}
888881
do_xmote(gl, gh, gl->gl_target);
889-
out:
890882
return;
891883

892884
out_sched:
@@ -2213,29 +2205,6 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
22132205
glock_hash_walk(dump_glock_func, sdp);
22142206
}
22152207

2216-
void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
2217-
{
2218-
struct gfs2_glock *gl = ip->i_gl;
2219-
int ret;
2220-
2221-
ret = gfs2_truncatei_resume(ip);
2222-
gfs2_glock_assert_withdraw(gl, ret == 0);
2223-
2224-
spin_lock(&gl->gl_lockref.lock);
2225-
clear_bit(GLF_LOCK, &gl->gl_flags);
2226-
run_queue(gl, 1);
2227-
wake_up_glock(gl);
2228-
spin_unlock(&gl->gl_lockref.lock);
2229-
}
2230-
2231-
void gfs2_wait_truncate(struct gfs2_inode *ip)
2232-
{
2233-
struct gfs2_glock *gl = ip->i_gl;
2234-
wait_queue_head_t *wq = glock_waitqueue(&gl->gl_name);
2235-
2236-
wait_event(*wq, !(ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG));
2237-
}
2238-
22392208
static const char *state2str(unsigned state)
22402209
{
22412210
switch(state) {

fs/gfs2/glock.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ extern void gfs2_cancel_delete_work(struct gfs2_glock *gl);
274274
extern bool gfs2_delete_work_queued(const struct gfs2_glock *gl);
275275
extern void gfs2_flush_delete_work(struct gfs2_sbd *sdp);
276276
extern void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);
277-
extern void gfs2_glock_finish_truncate(struct gfs2_inode *ip);
278-
extern void gfs2_wait_truncate(struct gfs2_inode *ip);
279277
extern void gfs2_glock_thaw(struct gfs2_sbd *sdp);
280278
extern void gfs2_glock_add_to_lru(struct gfs2_glock *gl);
281279
extern void gfs2_glock_free(struct gfs2_glock *gl);

fs/gfs2/glops.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
488488
static int inode_go_instantiate(struct gfs2_holder *gh)
489489
{
490490
struct gfs2_glock *gl = gh->gh_gl;
491-
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
492491
struct gfs2_inode *ip = gl->gl_object;
493492
int error = 0;
494493

@@ -504,14 +503,8 @@ static int inode_go_instantiate(struct gfs2_holder *gh)
504503

505504
if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) &&
506505
(gl->gl_state == LM_ST_EXCLUSIVE) &&
507-
(gh->gh_state == LM_ST_EXCLUSIVE)) {
508-
spin_lock(&sdp->sd_trunc_lock);
509-
if (list_empty(&ip->i_trunc_list))
510-
list_add(&ip->i_trunc_list, &sdp->sd_trunc_list);
511-
spin_unlock(&sdp->sd_trunc_lock);
512-
wake_up(&sdp->sd_quota_wait);
513-
gfs2_wait_truncate(ip);
514-
}
506+
(gh->gh_state == LM_ST_EXCLUSIVE))
507+
error = gfs2_truncatei_resume(ip);
515508

516509
out:
517510
return error;

fs/gfs2/incore.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ struct gfs2_inode {
396396
atomic_t i_sizehint; /* hint of the write size */
397397
struct rw_semaphore i_rw_mutex;
398398
struct list_head i_ordered;
399-
struct list_head i_trunc_list;
400399
__be64 *i_hash_cache;
401400
u32 i_entries;
402401
u32 i_diskflags;
@@ -784,8 +783,6 @@ struct gfs2_sbd {
784783
struct mutex sd_quota_mutex;
785784
struct mutex sd_quota_sync_mutex;
786785
wait_queue_head_t sd_quota_wait;
787-
struct list_head sd_trunc_list;
788-
spinlock_t sd_trunc_lock;
789786

790787
unsigned int sd_quota_slots;
791788
unsigned long *sd_quota_bitmap;

fs/gfs2/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static void gfs2_init_inode_once(void *foo)
3838
inode_init_once(&ip->i_inode);
3939
atomic_set(&ip->i_sizehint, 0);
4040
init_rwsem(&ip->i_rw_mutex);
41-
INIT_LIST_HEAD(&ip->i_trunc_list);
4241
INIT_LIST_HEAD(&ip->i_ordered);
4342
ip->i_qadata = NULL;
4443
gfs2_holder_mark_uninitialized(&ip->i_rgd_gh);

fs/gfs2/ops_fstype.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
106106
mutex_init(&sdp->sd_quota_mutex);
107107
mutex_init(&sdp->sd_quota_sync_mutex);
108108
init_waitqueue_head(&sdp->sd_quota_wait);
109-
INIT_LIST_HEAD(&sdp->sd_trunc_list);
110-
spin_lock_init(&sdp->sd_trunc_lock);
111109
spin_lock_init(&sdp->sd_bitmap_lock);
112110

113111
INIT_LIST_HEAD(&sdp->sd_sc_inodes_list);

fs/gfs2/quota.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,25 +1517,6 @@ static void quotad_check_timeo(struct gfs2_sbd *sdp, const char *msg,
15171517
}
15181518
}
15191519

1520-
static void quotad_check_trunc_list(struct gfs2_sbd *sdp)
1521-
{
1522-
struct gfs2_inode *ip;
1523-
1524-
while(1) {
1525-
ip = NULL;
1526-
spin_lock(&sdp->sd_trunc_lock);
1527-
if (!list_empty(&sdp->sd_trunc_list)) {
1528-
ip = list_first_entry(&sdp->sd_trunc_list,
1529-
struct gfs2_inode, i_trunc_list);
1530-
list_del_init(&ip->i_trunc_list);
1531-
}
1532-
spin_unlock(&sdp->sd_trunc_lock);
1533-
if (ip == NULL)
1534-
return;
1535-
gfs2_glock_finish_truncate(ip);
1536-
}
1537-
}
1538-
15391520
void gfs2_wake_up_statfs(struct gfs2_sbd *sdp) {
15401521
if (!sdp->sd_statfs_force_sync) {
15411522
sdp->sd_statfs_force_sync = 1;
@@ -1558,7 +1539,6 @@ int gfs2_quotad(void *data)
15581539
unsigned long quotad_timeo = 0;
15591540
unsigned long t = 0;
15601541
DEFINE_WAIT(wait);
1561-
int empty;
15621542

15631543
while (!kthread_should_stop()) {
15641544

@@ -1579,19 +1559,13 @@ int gfs2_quotad(void *data)
15791559
quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t,
15801560
&quotad_timeo, &tune->gt_quota_quantum);
15811561

1582-
/* Check for & recover partially truncated inodes */
1583-
quotad_check_trunc_list(sdp);
1584-
15851562
try_to_freeze();
15861563

15871564
bypass:
15881565
t = min(quotad_timeo, statfs_timeo);
15891566

15901567
prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_INTERRUPTIBLE);
1591-
spin_lock(&sdp->sd_trunc_lock);
1592-
empty = list_empty(&sdp->sd_trunc_list);
1593-
spin_unlock(&sdp->sd_trunc_lock);
1594-
if (empty && !sdp->sd_statfs_force_sync)
1568+
if (!sdp->sd_statfs_force_sync)
15951569
t -= schedule_timeout(t);
15961570
else
15971571
t = 0;

0 commit comments

Comments
 (0)