Skip to content

Commit 894b3c3

Browse files
committed
Merge tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "Three CephFS fixes from Xiubo and Luis and a bunch of assorted cleanups" * tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client: ceph: remove the incorrect Fw reference check when dirtying pages ceph: Remove empty definition in header file ceph: Fix typo in the comment ceph: fix a memory leak on cap_auths in MDS client ceph: flush all caps releases when syncing the whole filesystem ceph: rename ceph_flush_cap_releases() to ceph_flush_session_cap_releases() libceph: use min() to simplify code in ceph_dns_resolve_name() ceph: Convert to use jiffies macro ceph: Remove unused declarations
2 parents 9717d53 + c08dfb1 commit 894b3c3

File tree

10 files changed

+52
-26
lines changed

10 files changed

+52
-26
lines changed

fs/ceph/addr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
9696

9797
/* dirty the head */
9898
spin_lock(&ci->i_ceph_lock);
99-
BUG_ON(ci->i_wr_ref == 0); // caller should hold Fw reference
10099
if (__ceph_have_pending_cap_snap(ci)) {
101100
struct ceph_cap_snap *capsnap =
102101
list_last_entry(&ci->i_cap_snaps,

fs/ceph/caps.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/writeback.h>
1111
#include <linux/iversion.h>
1212
#include <linux/filelock.h>
13+
#include <linux/jiffies.h>
1314

1415
#include "super.h"
1516
#include "mds_client.h"
@@ -4149,7 +4150,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
41494150
ceph_remove_cap(mdsc, cap, false);
41504151
goto out_unlock;
41514152
} else if (tsession) {
4152-
/* add placeholder for the export tagert */
4153+
/* add placeholder for the export target */
41534154
int flag = (cap == ci->i_auth_cap) ? CEPH_CAP_FLAG_AUTH : 0;
41544155
tcap = new_cap;
41554156
ceph_add_cap(inode, tsession, t_cap_id, issued, 0,
@@ -4602,7 +4603,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
46024603
__ceph_queue_cap_release(session, cap);
46034604
spin_unlock(&session->s_cap_lock);
46044605
}
4605-
ceph_flush_cap_releases(mdsc, session);
4606+
ceph_flush_session_cap_releases(mdsc, session);
46064607
goto done;
46074608

46084609
bad:
@@ -4659,7 +4660,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
46594660
* slowness doesn't block mdsc delayed work,
46604661
* preventing send_renew_caps() from running.
46614662
*/
4662-
if (jiffies - loop_start >= 5 * HZ)
4663+
if (time_after_eq(jiffies, loop_start + 5 * HZ))
46634664
break;
46644665
}
46654666
spin_unlock(&mdsc->cap_delay_lock);
@@ -4701,6 +4702,28 @@ void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc)
47014702
ceph_mdsc_iterate_sessions(mdsc, flush_dirty_session_caps, true);
47024703
}
47034704

4705+
/*
4706+
* Flush all cap releases to the mds
4707+
*/
4708+
static void flush_cap_releases(struct ceph_mds_session *s)
4709+
{
4710+
struct ceph_mds_client *mdsc = s->s_mdsc;
4711+
struct ceph_client *cl = mdsc->fsc->client;
4712+
4713+
doutc(cl, "begin\n");
4714+
spin_lock(&s->s_cap_lock);
4715+
if (s->s_num_cap_releases)
4716+
ceph_flush_session_cap_releases(mdsc, s);
4717+
spin_unlock(&s->s_cap_lock);
4718+
doutc(cl, "done\n");
4719+
4720+
}
4721+
4722+
void ceph_flush_cap_releases(struct ceph_mds_client *mdsc)
4723+
{
4724+
ceph_mdsc_iterate_sessions(mdsc, flush_cap_releases, true);
4725+
}
4726+
47044727
void __ceph_touch_fmode(struct ceph_inode_info *ci,
47054728
struct ceph_mds_client *mdsc, int fmode)
47064729
{

fs/ceph/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ static int ceph_d_delete(const struct dentry *dentry)
20582058
return 0;
20592059
if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
20602060
return 0;
2061-
/* vaild lease? */
2061+
/* valid lease? */
20622062
di = ceph_dentry(dentry);
20632063
if (di) {
20642064
if (__dentry_lease_is_valid(di))

fs/ceph/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
17791779
if (err < 0)
17801780
goto done;
17811781
} else if (rinfo->head->is_dentry && req->r_dentry) {
1782-
/* parent inode is not locked, be carefull */
1782+
/* parent inode is not locked, be careful */
17831783
struct ceph_vino *ptvino = NULL;
17841784
dvino.ino = le64_to_cpu(rinfo->diri.in->ino);
17851785
dvino.snap = le64_to_cpu(rinfo->diri.in->snapid);

fs/ceph/mds_client.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ int ceph_trim_caps(struct ceph_mds_client *mdsc,
22662266
trim_caps - remaining);
22672267
}
22682268

2269-
ceph_flush_cap_releases(mdsc, session);
2269+
ceph_flush_session_cap_releases(mdsc, session);
22702270
return 0;
22712271
}
22722272

@@ -2420,7 +2420,7 @@ static void ceph_cap_release_work(struct work_struct *work)
24202420
ceph_put_mds_session(session);
24212421
}
24222422

2423-
void ceph_flush_cap_releases(struct ceph_mds_client *mdsc,
2423+
void ceph_flush_session_cap_releases(struct ceph_mds_client *mdsc,
24242424
struct ceph_mds_session *session)
24252425
{
24262426
struct ceph_client *cl = mdsc->fsc->client;
@@ -2447,7 +2447,7 @@ void __ceph_queue_cap_release(struct ceph_mds_session *session,
24472447
session->s_num_cap_releases++;
24482448

24492449
if (!(session->s_num_cap_releases % CEPH_CAPS_PER_RELEASE))
2450-
ceph_flush_cap_releases(session->s_mdsc, session);
2450+
ceph_flush_session_cap_releases(session->s_mdsc, session);
24512451
}
24522452

24532453
static void ceph_cap_reclaim_work(struct work_struct *work)
@@ -4340,7 +4340,7 @@ static void handle_session(struct ceph_mds_session *session,
43404340
/* flush cap releases */
43414341
spin_lock(&session->s_cap_lock);
43424342
if (session->s_num_cap_releases)
4343-
ceph_flush_cap_releases(mdsc, session);
4343+
ceph_flush_session_cap_releases(mdsc, session);
43444344
spin_unlock(&session->s_cap_lock);
43454345

43464346
send_flushmsg_ack(mdsc, session, seq);
@@ -4910,7 +4910,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
49104910
} else {
49114911
recon_state.msg_version = 2;
49124912
}
4913-
/* trsaverse this session's caps */
4913+
/* traverse this session's caps */
49144914
err = ceph_iterate_session_caps(session, reconnect_caps_cb, &recon_state);
49154915

49164916
spin_lock(&session->s_cap_lock);
@@ -5446,7 +5446,7 @@ static void delayed_work(struct work_struct *work)
54465446
}
54475447
mutex_unlock(&mdsc->mutex);
54485448

5449-
ceph_flush_cap_releases(mdsc, s);
5449+
ceph_flush_session_cap_releases(mdsc, s);
54505450

54515451
mutex_lock(&s->s_mutex);
54525452
if (renew_caps)
@@ -5877,6 +5877,7 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
58775877
mutex_unlock(&mdsc->mutex);
58785878

58795879
ceph_flush_dirty_caps(mdsc);
5880+
ceph_flush_cap_releases(mdsc);
58805881
spin_lock(&mdsc->cap_dirty_lock);
58815882
want_flush = mdsc->last_cap_flush_tid;
58825883
if (!list_empty(&mdsc->cap_flush_list)) {
@@ -6015,6 +6016,18 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
60156016
ceph_mdsmap_destroy(mdsc->mdsmap);
60166017
kfree(mdsc->sessions);
60176018
ceph_caps_finalize(mdsc);
6019+
6020+
if (mdsc->s_cap_auths) {
6021+
int i;
6022+
6023+
for (i = 0; i < mdsc->s_cap_auths_num; i++) {
6024+
kfree(mdsc->s_cap_auths[i].match.gids);
6025+
kfree(mdsc->s_cap_auths[i].match.path);
6026+
kfree(mdsc->s_cap_auths[i].match.fs_name);
6027+
}
6028+
kfree(mdsc->s_cap_auths);
6029+
}
6030+
60186031
ceph_pool_perm_destroy(mdsc);
60196032
}
60206033

fs/ceph/mds_client.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,6 @@ extern struct ceph_mds_session *
559559
ceph_get_mds_session(struct ceph_mds_session *s);
560560
extern void ceph_put_mds_session(struct ceph_mds_session *s);
561561

562-
extern int ceph_send_msg_mds(struct ceph_mds_client *mdsc,
563-
struct ceph_msg *msg, int mds);
564-
565562
extern int ceph_mdsc_init(struct ceph_fs_client *fsc);
566563
extern void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc);
567564
extern void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc);
@@ -602,8 +599,8 @@ extern void ceph_mdsc_iterate_sessions(struct ceph_mds_client *mdsc,
602599
extern struct ceph_msg *ceph_create_session_msg(u32 op, u64 seq);
603600
extern void __ceph_queue_cap_release(struct ceph_mds_session *session,
604601
struct ceph_cap *cap);
605-
extern void ceph_flush_cap_releases(struct ceph_mds_client *mdsc,
606-
struct ceph_mds_session *session);
602+
extern void ceph_flush_session_cap_releases(struct ceph_mds_client *mdsc,
603+
struct ceph_mds_session *session);
607604
extern void ceph_queue_cap_reclaim_work(struct ceph_mds_client *mdsc);
608605
extern void ceph_reclaim_caps_nr(struct ceph_mds_client *mdsc, int nr);
609606
extern void ceph_queue_cap_unlink_work(struct ceph_mds_client *mdsc);

fs/ceph/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static int ceph_sync_fs(struct super_block *sb, int wait)
126126
if (!wait) {
127127
doutc(cl, "(non-blocking)\n");
128128
ceph_flush_dirty_caps(fsc->mdsc);
129+
ceph_flush_cap_releases(fsc->mdsc);
129130
doutc(cl, "(non-blocking) done\n");
130131
return 0;
131132
}

fs/ceph/super.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,6 @@ extern int ceph_fill_trace(struct super_block *sb,
10561056
extern int ceph_readdir_prepopulate(struct ceph_mds_request *req,
10571057
struct ceph_mds_session *session);
10581058

1059-
extern int ceph_inode_holds_cap(struct inode *inode, int mask);
1060-
10611059
extern bool ceph_inode_set_size(struct inode *inode, loff_t size);
10621060
extern void __ceph_do_pending_vmtruncate(struct inode *inode);
10631061

@@ -1208,10 +1206,6 @@ static inline void ceph_init_inode_acls(struct inode *inode,
12081206
struct ceph_acl_sec_ctx *as_ctx)
12091207
{
12101208
}
1211-
static inline int ceph_acl_chmod(struct dentry *dentry, struct inode *inode)
1212-
{
1213-
return 0;
1214-
}
12151209

12161210
static inline void ceph_forget_all_cached_acls(struct inode *inode)
12171211
{
@@ -1270,6 +1264,7 @@ extern bool __ceph_should_report_size(struct ceph_inode_info *ci);
12701264
extern void ceph_check_caps(struct ceph_inode_info *ci, int flags);
12711265
extern unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc);
12721266
extern void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc);
1267+
extern void ceph_flush_cap_releases(struct ceph_mds_client *mdsc);
12731268
extern int ceph_drop_caps_for_unlink(struct inode *inode);
12741269
extern int ceph_encode_inode_release(void **p, struct inode *inode,
12751270
int mds, int drop, int unless, int force);

include/linux/ceph/osd_client.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,6 @@ extern int ceph_osdc_init(struct ceph_osd_client *osdc,
449449
extern void ceph_osdc_stop(struct ceph_osd_client *osdc);
450450
extern void ceph_osdc_reopen_osds(struct ceph_osd_client *osdc);
451451

452-
extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
453-
struct ceph_msg *msg);
454452
extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
455453
struct ceph_msg *msg);
456454
void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb);

net/ceph/messenger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen,
12541254
colon_p = memchr(name, ':', namelen);
12551255

12561256
if (delim_p && colon_p)
1257-
end = delim_p < colon_p ? delim_p : colon_p;
1257+
end = min(delim_p, colon_p);
12581258
else if (!delim_p && colon_p)
12591259
end = colon_p;
12601260
else {

0 commit comments

Comments
 (0)