Skip to content

Commit 65d6e95

Browse files
committed
Merge tag 'gfs2-v6.5-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 updates from Andreas Gruenbacher: - Fix a glock state (non-)transition bug when a dlm request times out and is canceled, and we have locking requests that can now be granted immediately - Various fixes and cleanups in how the logd and quotad daemons are woken up and terminated - Fix several bugs in the quota data reference counting and shrinking. Free quota data objects synchronously in put_super() instead of letting call_rcu() run wild - Make sure not to deallocate quota data during a withdraw; rather, defer quota data deallocation to put_super(). Withdraws can happen in contexts in which callers on the stack are holding quota data references - Many minor quota fixes and cleanups by Bob - Update the the mailing list address for gfs2 and dlm. (It's the same list for both and we are moving it to gfs2@lists.linux.dev) - Various other minor cleanups * tag 'gfs2-v6.5-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: (51 commits) MAINTAINERS: Update dlm mailing list MAINTAINERS: Update gfs2 mailing list gfs2: change qd_slot_count to qd_slot_ref gfs2: check for no eligible quota changes gfs2: Remove useless assignment gfs2: simplify slot_get gfs2: Simplify qd2offset gfs2: introduce qd_bh_get_or_undo gfs2: Remove quota allocation info from quota file gfs2: use constant for array size gfs2: Set qd_sync_gen in do_sync gfs2: Remove useless err set gfs2: Small gfs2_quota_lock cleanup gfs2: move qdsb_put and reduce redundancy gfs2: improvements to sysfs status gfs2: Don't try to sync non-changes gfs2: Simplify function need_sync gfs2: remove unneeded pg_oflow variable gfs2: remove unneeded variable done gfs2: pass sdp to gfs2_write_buf_to_page ...
2 parents 9e310ea + 2938fd7 commit 65d6e95

File tree

21 files changed

+347
-330
lines changed

21 files changed

+347
-330
lines changed

Documentation/filesystems/gfs2-glocks.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ The gl_holders list contains all the queued lock requests (not
2020
just the holders) associated with the glock. If there are any
2121
held locks, then they will be contiguous entries at the head
2222
of the list. Locks are granted in strictly the order that they
23-
are queued, except for those marked LM_FLAG_PRIORITY which are
24-
used only during recovery, and even then only for journal locks.
23+
are queued.
2524

2625
There are three lock states that users of the glock layer can request,
2726
namely shared (SH), deferred (DF) and exclusive (EX). Those translate

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6118,7 +6118,7 @@ F: include/video/udlfb.h
61186118
DISTRIBUTED LOCK MANAGER (DLM)
61196119
M: Christine Caulfield <ccaulfie@redhat.com>
61206120
M: David Teigland <teigland@redhat.com>
6121-
L: cluster-devel@redhat.com
6121+
L: gfs2@lists.linux.dev
61226122
S: Supported
61236123
W: http://sources.redhat.com/cluster/
61246124
T: git git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git
@@ -8774,7 +8774,7 @@ F: scripts/get_maintainer.pl
87748774
GFS2 FILE SYSTEM
87758775
M: Bob Peterson <rpeterso@redhat.com>
87768776
M: Andreas Gruenbacher <agruenba@redhat.com>
8777-
L: cluster-devel@redhat.com
8777+
L: gfs2@lists.linux.dev
87788778
S: Supported
87798779
B: https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=gfs2
87808780
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git

fs/gfs2/aops.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ static int gfs2_writepages(struct address_space *mapping,
183183
int ret;
184184

185185
/*
186-
* Even if we didn't write any pages here, we might still be holding
186+
* Even if we didn't write enough pages here, we might still be holding
187187
* dirty pages in the ail. We forcibly flush the ail because we don't
188188
* want balance_dirty_pages() to loop indefinitely trying to write out
189189
* pages held in the ail that it can't find.
190190
*/
191191
ret = iomap_writepages(mapping, wbc, &wpc, &gfs2_writeback_ops);
192-
if (ret == 0)
192+
if (ret == 0 && wbc->nr_to_write > 0)
193193
set_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags);
194194
return ret;
195195
}
@@ -272,8 +272,7 @@ static int gfs2_write_jdata_batch(struct address_space *mapping,
272272
* not be suitable for data integrity
273273
* writeout).
274274
*/
275-
*done_index = folio->index +
276-
folio_nr_pages(folio);
275+
*done_index = folio_next_index(folio);
277276
ret = 1;
278277
break;
279278
}

fs/gfs2/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip)
161161
int error;
162162

163163
down_write(&ip->i_rw_mutex);
164-
page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS);
164+
page = grab_cache_page(inode->i_mapping, 0);
165165
error = -ENOMEM;
166166
if (!page)
167167
goto out;

fs/gfs2/glock.c

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void gfs2_glock_free(struct gfs2_glock *gl)
176176
wake_up_glock(gl);
177177
call_rcu(&gl->gl_rcu, gfs2_glock_dealloc);
178178
if (atomic_dec_and_test(&sdp->sd_glock_disposal))
179-
wake_up(&sdp->sd_glock_wait);
179+
wake_up(&sdp->sd_kill_wait);
180180
}
181181

182182
/**
@@ -468,10 +468,10 @@ int gfs2_instantiate(struct gfs2_holder *gh)
468468
* do_promote - promote as many requests as possible on the current queue
469469
* @gl: The glock
470470
*
471-
* Returns: 1 if there is a blocked holder at the head of the list
471+
* Returns true on success (i.e., progress was made or there are no waiters).
472472
*/
473473

474-
static int do_promote(struct gfs2_glock *gl)
474+
static bool do_promote(struct gfs2_glock *gl)
475475
{
476476
struct gfs2_holder *gh, *current_gh;
477477

@@ -484,10 +484,10 @@ static int do_promote(struct gfs2_glock *gl)
484484
* If we get here, it means we may not grant this
485485
* holder for some reason. If this holder is at the
486486
* head of the list, it means we have a blocked holder
487-
* at the head, so return 1.
487+
* at the head, so return false.
488488
*/
489489
if (list_is_first(&gh->gh_list, &gl->gl_holders))
490-
return 1;
490+
return false;
491491
do_error(gl, 0);
492492
break;
493493
}
@@ -497,7 +497,7 @@ static int do_promote(struct gfs2_glock *gl)
497497
if (!current_gh)
498498
current_gh = gh;
499499
}
500-
return 0;
500+
return true;
501501
}
502502

503503
/**
@@ -591,10 +591,11 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
591591
if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) {
592592
/* move to back of queue and try next entry */
593593
if (ret & LM_OUT_CANCELED) {
594-
if ((gh->gh_flags & LM_FLAG_PRIORITY) == 0)
595-
list_move_tail(&gh->gh_list, &gl->gl_holders);
594+
list_move_tail(&gh->gh_list, &gl->gl_holders);
596595
gh = find_first_waiter(gl);
597596
gl->gl_target = gh->gh_state;
597+
if (do_promote(gl))
598+
goto out;
598599
goto retry;
599600
}
600601
/* Some error or failed "try lock" - report it */
@@ -679,8 +680,7 @@ __acquires(&gl->gl_lockref.lock)
679680
gh && !(gh->gh_flags & LM_FLAG_NOEXP))
680681
goto skip_inval;
681682

682-
lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP |
683-
LM_FLAG_PRIORITY);
683+
lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP);
684684
GLOCK_BUG_ON(gl, gl->gl_state == target);
685685
GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
686686
if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) &&
@@ -834,7 +834,7 @@ __acquires(&gl->gl_lockref.lock)
834834
} else {
835835
if (test_bit(GLF_DEMOTE, &gl->gl_flags))
836836
gfs2_demote_wake(gl);
837-
if (do_promote(gl) == 0)
837+
if (do_promote(gl))
838838
goto out_unlock;
839839
gh = find_first_waiter(gl);
840840
gl->gl_target = gh->gh_state;
@@ -1022,7 +1022,7 @@ static void delete_work_func(struct work_struct *work)
10221022
* step entirely.
10231023
*/
10241024
if (gfs2_try_evict(gl)) {
1025-
if (test_bit(SDF_DEACTIVATING, &sdp->sd_flags))
1025+
if (test_bit(SDF_KILL, &sdp->sd_flags))
10261026
goto out;
10271027
if (gfs2_queue_verify_evict(gl))
10281028
return;
@@ -1035,7 +1035,7 @@ static void delete_work_func(struct work_struct *work)
10351035
GFS2_BLKST_UNLINKED);
10361036
if (IS_ERR(inode)) {
10371037
if (PTR_ERR(inode) == -EAGAIN &&
1038-
!test_bit(SDF_DEACTIVATING, &sdp->sd_flags) &&
1038+
!test_bit(SDF_KILL, &sdp->sd_flags) &&
10391039
gfs2_queue_verify_evict(gl))
10401040
return;
10411041
} else {
@@ -1231,7 +1231,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
12311231
out_free:
12321232
gfs2_glock_dealloc(&gl->gl_rcu);
12331233
if (atomic_dec_and_test(&sdp->sd_glock_disposal))
1234-
wake_up(&sdp->sd_glock_wait);
1234+
wake_up(&sdp->sd_kill_wait);
12351235

12361236
out:
12371237
return ret;
@@ -1515,27 +1515,20 @@ __acquires(&gl->gl_lockref.lock)
15151515
}
15161516
if (test_bit(HIF_HOLDER, &gh2->gh_iflags))
15171517
continue;
1518-
if (unlikely((gh->gh_flags & LM_FLAG_PRIORITY) && !insert_pt))
1519-
insert_pt = &gh2->gh_list;
15201518
}
15211519
trace_gfs2_glock_queue(gh, 1);
15221520
gfs2_glstats_inc(gl, GFS2_LKS_QCOUNT);
15231521
gfs2_sbstats_inc(gl, GFS2_LKS_QCOUNT);
15241522
if (likely(insert_pt == NULL)) {
15251523
list_add_tail(&gh->gh_list, &gl->gl_holders);
1526-
if (unlikely(gh->gh_flags & LM_FLAG_PRIORITY))
1527-
goto do_cancel;
15281524
return;
15291525
}
15301526
list_add_tail(&gh->gh_list, insert_pt);
1531-
do_cancel:
15321527
gh = list_first_entry(&gl->gl_holders, struct gfs2_holder, gh_list);
1533-
if (!(gh->gh_flags & LM_FLAG_PRIORITY)) {
1534-
spin_unlock(&gl->gl_lockref.lock);
1535-
if (sdp->sd_lockstruct.ls_ops->lm_cancel)
1536-
sdp->sd_lockstruct.ls_ops->lm_cancel(gl);
1537-
spin_lock(&gl->gl_lockref.lock);
1538-
}
1528+
spin_unlock(&gl->gl_lockref.lock);
1529+
if (sdp->sd_lockstruct.ls_ops->lm_cancel)
1530+
sdp->sd_lockstruct.ls_ops->lm_cancel(gl);
1531+
spin_lock(&gl->gl_lockref.lock);
15391532
return;
15401533

15411534
trap_recursive:
@@ -2195,7 +2188,7 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
21952188
flush_workqueue(glock_workqueue);
21962189
glock_hash_walk(clear_glock, sdp);
21972190
flush_workqueue(glock_workqueue);
2198-
wait_event_timeout(sdp->sd_glock_wait,
2191+
wait_event_timeout(sdp->sd_kill_wait,
21992192
atomic_read(&sdp->sd_glock_disposal) == 0,
22002193
HZ * 600);
22012194
glock_hash_walk(dump_glock_func, sdp);
@@ -2227,8 +2220,6 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
22272220
*p++ = 'e';
22282221
if (flags & LM_FLAG_ANY)
22292222
*p++ = 'A';
2230-
if (flags & LM_FLAG_PRIORITY)
2231-
*p++ = 'p';
22322223
if (flags & LM_FLAG_NODE_SCOPE)
22332224
*p++ = 'n';
22342225
if (flags & GL_ASYNC)

fs/gfs2/glock.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ enum {
6868
* also be granted in SHARED. The preferred state is whichever is compatible
6969
* with other granted locks, or the specified state if no other locks exist.
7070
*
71-
* LM_FLAG_PRIORITY
72-
* Override fairness considerations. Suppose a lock is held in a shared state
73-
* and there is a pending request for the deferred state. A shared lock
74-
* request with the priority flag would be allowed to bypass the deferred
75-
* request and directly join the other shared lock. A shared lock request
76-
* without the priority flag might be forced to wait until the deferred
77-
* requested had acquired and released the lock.
78-
*
7971
* LM_FLAG_NODE_SCOPE
8072
* This holder agrees to share the lock within this node. In other words,
8173
* the glock is held in EX mode according to DLM, but local holders on the
@@ -86,7 +78,6 @@ enum {
8678
#define LM_FLAG_TRY_1CB 0x0002
8779
#define LM_FLAG_NOEXP 0x0004
8880
#define LM_FLAG_ANY 0x0008
89-
#define LM_FLAG_PRIORITY 0x0010
9081
#define LM_FLAG_NODE_SCOPE 0x0020
9182
#define GL_ASYNC 0x0040
9283
#define GL_EXACT 0x0080

fs/gfs2/glops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
637637
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
638638

639639
if (!remote || sb_rdonly(sdp->sd_vfs) ||
640-
test_bit(SDF_DEACTIVATING, &sdp->sd_flags))
640+
test_bit(SDF_KILL, &sdp->sd_flags))
641641
return;
642642

643643
if (gl->gl_demote_state == LM_ST_UNLOCKED &&

fs/gfs2/incore.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ struct gfs2_quota_data {
452452
s64 qd_change_sync;
453453

454454
unsigned int qd_slot;
455-
unsigned int qd_slot_count;
455+
unsigned int qd_slot_ref;
456456

457457
struct buffer_head *qd_bh;
458458
struct gfs2_quota_change *qd_bh_qc;
@@ -537,6 +537,7 @@ struct gfs2_statfs_change_host {
537537
#define GFS2_QUOTA_OFF 0
538538
#define GFS2_QUOTA_ACCOUNT 1
539539
#define GFS2_QUOTA_ON 2
540+
#define GFS2_QUOTA_QUIET 3 /* on but not complaining */
540541

541542
#define GFS2_DATA_DEFAULT GFS2_DATA_ORDERED
542543
#define GFS2_DATA_WRITEBACK 1
@@ -606,7 +607,7 @@ enum {
606607
SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */
607608
SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are
608609
withdrawing */
609-
SDF_DEACTIVATING = 15,
610+
SDF_KILL = 15,
610611
SDF_EVICTING = 16,
611612
SDF_FROZEN = 17,
612613
};
@@ -716,7 +717,7 @@ struct gfs2_sbd {
716717
struct gfs2_glock *sd_rename_gl;
717718
struct gfs2_glock *sd_freeze_gl;
718719
struct work_struct sd_freeze_work;
719-
wait_queue_head_t sd_glock_wait;
720+
wait_queue_head_t sd_kill_wait;
720721
wait_queue_head_t sd_async_glock_wait;
721722
atomic_t sd_glock_disposal;
722723
struct completion sd_locking_init;

fs/gfs2/inode.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,16 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
276276
* gfs2_lookup_simple callers expect ENOENT
277277
* and do not check for NULL.
278278
*/
279-
if (inode == NULL)
280-
return ERR_PTR(-ENOENT);
281-
else
282-
return inode;
279+
if (IS_ERR_OR_NULL(inode))
280+
return inode ? inode : ERR_PTR(-ENOENT);
281+
282+
/*
283+
* Must not call back into the filesystem when allocating
284+
* pages in the metadata inode's address space.
285+
*/
286+
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
287+
288+
return inode;
283289
}
284290

285291

fs/gfs2/lock_dlm.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
222222
lkf |= DLM_LKF_NOQUEUEBAST;
223223
}
224224

225-
if (gfs_flags & LM_FLAG_PRIORITY) {
226-
lkf |= DLM_LKF_NOORDER;
227-
lkf |= DLM_LKF_HEADQUE;
228-
}
229-
230225
if (gfs_flags & LM_FLAG_ANY) {
231226
if (req == DLM_LOCK_PR)
232227
lkf |= DLM_LKF_ALTCW;

0 commit comments

Comments
 (0)