mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xiubo Li via B4 Relay <devnull+xiubo.li.clyso.com@kernel.org>,
	Ilya Dryomov <idryomov@gmail.com>,
	Alex Markuze <amarkuze@redhat.com>,
	Viacheslav Dubeyko <slava@dubeyko.com>
Cc: oe-kbuild-all@lists.linux.dev, ceph-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Xiubo Li <xiubo.li@clyso.com>
Subject: Re: [PATCH 2/2] ceph: don't let a mapped write overwrite other clients' writes
Date: Sat, 5 Dec 2026 17:55:01 +0800	[thread overview]
Message-ID: <20261204215859.a5U1Zloy-lkp@intel.com> (raw)
In-Reply-To: <20261204-ceph-mmap-no-overwrite-v1-2-323689b39a29@clyso.com>

Hi Xiubo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3f90412e989cb381d4bf96260468f5c7b2d08655]

url:    https://github.com/intel-lab-lkp/linux/commits/Xiubo-Li-via-B4-Relay/libceph-add-the-CMPEXT-OSD-op/20261204-012211
base:   3f90412e989cb381d4bf96260468f5c7b2d08655
patch link:    https://lore.kernel.org/r/20261204-ceph-mmap-no-overwrite-v1-2-323689b39a29%40clyso.com
patch subject: [PATCH 2/2] ceph: don't let a mapped write overwrite other clients' writes
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20261204/20261204215859.a5U1Zloy-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204215859.a5U1Zloy-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261204215859.a5U1Zloy-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/ceph/addr.c: In function 'ceph_write_kept':
>> fs/ceph/addr.c:1517:1: warning: the frame size of 1352 bytes is larger than 1280 bytes [-Wframe-larger-than=]
    1517 | }
         | ^


vim +1517 fs/ceph/addr.c

  1339	
  1340	/*
  1341	 * Write back the runs @ext[0..@n) of the locked @folios, which
  1342	 * ceph_folio_keep_base() kept a copy of when they got dirty.  See there.
  1343	 * The runs are all in one object.
  1344	 *
  1345	 * Send the folios whole, each run after a compare of the object's bytes
  1346	 * against the copy, in the same request: the OSD writes a request only
  1347	 * if no other client wrote there since.  The requests are all in flight
  1348	 * at once.
  1349	 *
  1350	 * A request that lost its compare goes again with only the bytes this
  1351	 * client changed: the bytes it did not change are left as other clients
  1352	 * wrote them meanwhile.  That is what a merge of the folio with what is
  1353	 * there now would write, in one more round trip, and without a read.
  1354	 * Whole folios go out when nobody else writes, though: writes that do
  1355	 * not cover whole blocks are more work for the OSD.  For a while after a
  1356	 * lost compare, the changed bytes are sent right away.
  1357	 *
  1358	 * A byte this client set to the value it had in the copy, after another
  1359	 * client changed it, is taken as not changed: that store is ordered
  1360	 * before the other client's write.
  1361	 *
  1362	 * Returns 0 or a negative error.
  1363	 */
  1364	static int ceph_write_kept(struct inode *inode, struct folio **folios,
  1365				   struct ceph_merge_ext *ext, int n,
  1366				   struct page **pgbuf,
  1367				   struct ceph_snap_context *snapc,
  1368				   struct ceph_writeback_ctl *ceph_wbc)
  1369	{
  1370		struct ceph_inode_info *ci = ceph_inode(inode);
  1371		struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
  1372		struct ceph_client *cl = fsc->client;
  1373		struct ceph_osd_client *osdc = &fsc->client->osdc;
  1374		int nreq = DIV_ROUND_UP(n, CEPH_MERGE_EXTS_PER_REQ);
  1375		struct ceph_osd_request *reqs[DIV_ROUND_UP(CEPH_MERGE_MAX_EXTS,
  1376							   CEPH_MERGE_EXTS_PER_REQ)];
  1377		struct page **pages, **bpages;
  1378		unsigned long conflict = READ_ONCE(ci->i_kept_conflict);
  1379		int i, q, f, npages = 0, nlost = 0, err = 0, err2;
  1380	
  1381		for (i = 0; i < n; i++)
  1382			for (f = ext[i].first; f < ext[i].first + ext[i].nr; f++)
  1383				npages += folio_nr_pages(folios[f]);
  1384		if (pgbuf && npages <= CEPH_MERGE_MAX_FOLIOS) {
  1385			/* no allocation for order-0 folios gathered in a batch */
  1386			pages = pgbuf;
  1387			bpages = pgbuf + npages;
  1388		} else {
  1389			pgbuf = NULL;
  1390			pages = kmalloc_array(npages, sizeof(*pages), GFP_NOFS);
  1391			bpages = kmalloc_array(npages, sizeof(*bpages), GFP_NOFS);
  1392			if (!pages || !bpages) {
  1393				kfree(bpages);
  1394				kfree(pages);
  1395				return -ENOMEM;
  1396			}
  1397		}
  1398		npages = 0;
  1399		for (i = 0; i < n; i++) {
  1400			ext[i].pg = npages;
  1401			for (f = ext[i].first; f < ext[i].first + ext[i].nr; f++) {
  1402				struct folio *base = ceph_folio_base(folios[f]);
  1403				int pg;
  1404	
  1405				for (pg = 0; pg < folio_nr_pages(folios[f]); pg++) {
  1406					pages[npages] = folio_page(folios[f], pg);
  1407					bpages[npages++] = folio_page(base, pg);
  1408				}
  1409			}
  1410		}
  1411	
  1412		if (!time_in_range(jiffies, conflict,
  1413				   conflict + CEPH_KEPT_CONFLICT_HOLD)) {
  1414			struct ceph_diff_run runs[2 * CEPH_MERGE_MAX_EXTS];
  1415			int ext_of[2 * CEPH_MERGE_MAX_EXTS];
  1416			int total = ceph_diff_runs(ext, n, folios, runs, ext_of,
  1417						   2 * n);
  1418	
  1419			if (total <= 2 * n) {
  1420				err = total ? ceph_send_diff(inode, pages, ext, runs,
  1421							     ext_of, total, snapc,
  1422							     ceph_wbc) : 0;
  1423				goto out;
  1424			}
  1425		}
  1426		if (time_in_range(jiffies, conflict,
  1427				  conflict + CEPH_KEPT_CONFLICT_HOLD)) {
  1428			err = ceph_write_diff(inode, folios, pages, ext, n, snapc,
  1429					      ceph_wbc);
  1430			goto out;
  1431		}
  1432	
  1433		for (q = 0; q < nreq; q++) {
  1434			struct ceph_merge_ext *qe = &ext[q * CEPH_MERGE_EXTS_PER_REQ];
  1435			int m = min(n - q * CEPH_MERGE_EXTS_PER_REQ,
  1436				    CEPH_MERGE_EXTS_PER_REQ);
  1437			struct ceph_osd_request *req;
  1438			u64 wlen = qe[0].len, tsize;
  1439			u32 tseq;
  1440	
  1441			req = ceph_osdc_new_request(osdc, &ci->i_layout,
  1442						    ceph_vino(inode), qe[0].off, &wlen,
  1443						    1, 2 * m, CEPH_OSD_OP_WRITE,
  1444						    CEPH_OSD_FLAG_WRITE, snapc,
  1445						    ceph_wbc->truncate_seq,
  1446						    ceph_wbc->truncate_size, false);
  1447			if (IS_ERR(req)) {
  1448				reqs[q] = NULL;
  1449				err = PTR_ERR(req);
  1450				continue;
  1451			}
  1452			if (WARN_ON_ONCE(wlen != qe[0].len)) {
  1453				/* a folio crosses an object boundary */
  1454				ceph_osdc_put_request(req);
  1455				reqs[q] = NULL;
  1456				err = -EIO;
  1457				continue;
  1458			}
  1459			tsize = req->r_ops[1].extent.truncate_size;
  1460			tseq = req->r_ops[1].extent.truncate_seq;
  1461			for (i = 0; i < m; i++) {
  1462				const struct ceph_merge_ext *e = &qe[i];
  1463	
  1464				osd_req_op_extent_init(req, 2 * i, CEPH_OSD_OP_CMPEXT,
  1465						       e->objoff, e->len, tsize, tseq);
  1466				osd_req_op_extent_osd_data_pages(req, 2 * i,
  1467								 bpages + e->pg, e->len,
  1468								 0, false, false);
  1469				if (i)
  1470					osd_req_op_extent_init(req, 2 * i + 1,
  1471							       CEPH_OSD_OP_WRITE,
  1472							       e->objoff, e->len,
  1473							       tsize, tseq);
  1474				osd_req_op_extent_osd_data_pages(req, 2 * i + 1,
  1475								 pages + e->pg, e->len,
  1476								 0, false, false);
  1477			}
  1478			req->r_mtime = inode_get_mtime(inode);
  1479			ceph_osdc_start_request(osdc, req);
  1480			reqs[q] = req;
  1481		}
  1482	
  1483		for (q = 0; q < nreq; q++) {
  1484			struct ceph_merge_ext *qe = &ext[q * CEPH_MERGE_EXTS_PER_REQ];
  1485			int m = min(n - q * CEPH_MERGE_EXTS_PER_REQ,
  1486				    CEPH_MERGE_EXTS_PER_REQ);
  1487			size_t bytes = 0;
  1488	
  1489			if (!reqs[q])
  1490				continue;
  1491			err2 = ceph_osdc_wait_request(osdc, reqs[q]);
  1492			for (i = 0; i < m; i++)
  1493				bytes += qe[i].len;
  1494			ceph_update_write_metrics(&fsc->mdsc->metric,
  1495						  reqs[q]->r_start_latency,
  1496						  reqs[q]->r_end_latency, bytes,
  1497						  CEPH_CMPEXT_MISMATCH(err2) ? 0 : err2);
  1498			ceph_osdc_put_request(reqs[q]);
  1499			if (CEPH_CMPEXT_MISMATCH(err2)) {
  1500				/* lost the compare: send what this client changed */
  1501				nlost++;
  1502				WRITE_ONCE(ci->i_kept_conflict, jiffies);
  1503				err2 = ceph_write_diff(inode, folios, pages, qe, m,
  1504						       snapc, ceph_wbc);
  1505			}
  1506			if (!err)
  1507				err = err2;
  1508		}
  1509		doutc(cl, "%llx.%llx %llu~%zu %d runs of folios, %d requests lost the compare\n",
  1510		      ceph_vinop(inode), ext[0].off, ext[0].len, n, nlost);
  1511	out:
  1512		if (!pgbuf) {
  1513			kfree(bpages);
  1514			kfree(pages);
  1515		}
  1516		return err;
> 1517	}
  1518	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2026-12-05  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  0:22 [PATCH 0/2] " Xiubo Li via B4 Relay
2026-12-04  0:22 ` [PATCH 1/2] libceph: add the CMPEXT OSD op Xiubo Li via B4 Relay
2026-12-04  0:22 ` [PATCH 2/2] ceph: don't let a mapped write overwrite other clients' writes Xiubo Li via B4 Relay
2026-12-05  9:55   ` kernel test robot [this message]
2026-12-05 10:55     ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204215859.a5U1Zloy-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=amarkuze@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=devnull+xiubo.li.clyso.com@kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=slava@dubeyko.com \
    --cc=xiubo.li@clyso.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®