From nobody Sat Jan 15 00:51:41 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 817761951434; Sat, 15 Jan 2022 00:51:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JbKP92d5bz4k8M; Sat, 15 Jan 2022 00:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WIP0PqygIm0GfBndVPcSwNKXQEnyeAsoEVpRmXLV76k=; b=Vr5MpSOc+Sc96Mvm1YC25+kY7eE2eQOLZEd4x68wdeDcT4T0iCg1SKgYdsghd8RMU8ScSs e+EWCxrF8kXAb8EbZmht2iNpJd7Q4Ikf7bBmPrxaN+14y1QJBRmO11lxj/JueeXJ9xVj0H wWO4IkefzA0neHyHEDHevPaxhNbEvBaZTmDtyxCqAlaf7dDKl6IEAX1cQgGvHTPYpr0X00 eiZEpMHAQWs5uialQ9WSSrfyQPQao6yBVlxTtU9l+8t6wb34Tg//7ugX3M7jIjssurhW/o 68uXaOrHegNZesGN8BXLnrD1C1ikxuVszleZlnyYVBHqXdkqvm0KM6Kc/gwgmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 310A61D6E2; Sat, 15 Jan 2022 00:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20F0pfdm031200; Sat, 15 Jan 2022 00:51:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20F0pfmY031199; Sat, 15 Jan 2022 00:51:41 GMT (envelope-from git) Date: Sat, 15 Jan 2022 00:51:41 GMT Message-Id: <202201150051.20F0pfmY031199@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c1df4eef1285 - stable/13 - msdosfs: clusterfree() is used only in error handling cases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c1df4eef1285793dc9b7c80296e771c55e86cdab Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WIP0PqygIm0GfBndVPcSwNKXQEnyeAsoEVpRmXLV76k=; b=tAUnBRQ5OQcQ1A+msPoE2lpc4rz68yXB2NmLW3BzSYtiYphTFPjrGpH/Fg0vhxqWfEblW1 RSfCeEtqX/Y7+4l4wFm7xzFiBSdoLmDdcdNKTD43TZ1U+DY12LJKzkHg1HtFbdJhW6f9OW VUmTcNJ6PlW8kzN5zu7PMIo2BPBzGHUeBeAAgfuZz6EeuDVo9yF5V2DAuUCB9q2Fh9CaQx L1dkM6KYcyb40djAcsNYjQVNCfThNoafHg36i83ePjXEVzbrdOLkji/tPEFgSDzPHIUBQt VwT2Tp0X25p6SYimSmjpWp0RrisdGrZ8mDFR/qipMm5TsL2HDaS57OQ14kXZrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642207901; a=rsa-sha256; cv=none; b=jpOdfc4IiIFhWQZtKWecpoh2934ljqk1AyJ4yTU1SjwXX9tEDm2dImGiJOCNjC7avccsmG ggztuTYE8xOZlIEVR4YXmVXAWGOGNKAYrGFaZgBYglwfuCGuvjwqcbhYzHC8Ails+kKV9K crn3Xt42b4GGO8x4hXM4+pS4ws7pbjFtZ8mqmk72cOTycdu5UZsPGv049jsVEUufzdVBR3 dq//zTibS+JIcck7RtlMhzmSbuKOEwe5LIpCT0wfSQP0wZ55uDlBSC33t/+NMChn27oRjW uZlSDw56ZMEIxGwW5VYS57IYyD2ziaZY5ZS4BfphiJIfHrRRbVjCjbgs+7lJJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c1df4eef1285793dc9b7c80296e771c55e86cdab commit c1df4eef1285793dc9b7c80296e771c55e86cdab Author: Konstantin Belousov AuthorDate: 2022-01-04 14:43:02 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 18:11:02 +0000 msdosfs: clusterfree() is used only in error handling cases (cherry picked from commit 65990b68a2cd89a08f0350e187df1968b16f4255) --- sys/fs/msdosfs/fat.h | 2 +- sys/fs/msdosfs/msdosfs_fat.c | 13 +++++-------- sys/fs/msdosfs/msdosfs_vnops.c | 2 +- usr.sbin/makefs/msdos/msdosfs_fat.c | 13 +++++-------- usr.sbin/makefs/msdos/msdosfs_vnops.c | 2 +- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/sys/fs/msdosfs/fat.h b/sys/fs/msdosfs/fat.h index bb0f128eaa87..b28a9bed1356 100644 --- a/sys/fs/msdosfs/fat.h +++ b/sys/fs/msdosfs/fat.h @@ -97,7 +97,7 @@ #define DE_CLEAR 1 /* Zero out the blocks allocated */ int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp); -int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp); +void clusterfree(struct msdosfsmount *pmp, u_long cn); int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); int fatentry(int function, struct msdosfsmount *pmp, u_long cluster, u_long *oldcontents, u_long newcontents); int freeclusterchain(struct msdosfsmount *pmp, u_long startchain); diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index 202feeef0102..fc1db705989b 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -420,15 +420,15 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) return (0); } -int -clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) +void +clusterfree(struct msdosfsmount *pmp, u_long cluster) { int error; u_long oldcn; error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE); - if (error) - return (error); + if (error != 0) + return; /* * If the cluster was successfully marked free, then update * the count of free clusters, and turn off the "allocated" @@ -437,9 +437,6 @@ clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) MSDOSFS_LOCK_MP(pmp); error = usemap_free(pmp, cluster); MSDOSFS_UNLOCK_MP(pmp); - if (error == 0 && oldcnp != NULL) - *oldcnp = oldcn; - return (error); } /* @@ -1056,7 +1053,7 @@ extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, dep->de_fc[FC_LASTFC].fc_fsrcn, 0, cn); if (error) { - clusterfree(pmp, cn, NULL); + clusterfree(pmp, cn); return (error); } frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1; diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index d64dcf4266bb..58f7f2876523 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1433,7 +1433,7 @@ msdosfs_mkdir(struct vop_mkdir_args *ap) return (0); bad: - clusterfree(pmp, newcluster, NULL); + clusterfree(pmp, newcluster); bad2: return (error); } diff --git a/usr.sbin/makefs/msdos/msdosfs_fat.c b/usr.sbin/makefs/msdos/msdosfs_fat.c index eacc448b09de..63410b8b7d1f 100644 --- a/usr.sbin/makefs/msdos/msdosfs_fat.c +++ b/usr.sbin/makefs/msdos/msdosfs_fat.c @@ -410,24 +410,21 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); } -int -clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) +void +clusterfree(struct msdosfsmount *pmp, u_long cluster) { int error; u_long oldcn; error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE); - if (error) - return (error); + if (error != 0) + return; /* * If the cluster was successfully marked free, then update * the count of free clusters, and turn off the "allocated" * bit in the "in use" cluster bit map. */ usemap_free(pmp, cluster); - if (oldcnp) - *oldcnp = oldcn; - return (0); } /* @@ -1024,7 +1021,7 @@ extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, dep->de_fc[FC_LASTFC].fc_fsrcn, 0, cn); if (error) { - clusterfree(pmp, cn, NULL); + clusterfree(pmp, cn); return (error); } frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1; diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c index 8bd4d3d498d8..6f1275ee125d 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vnops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c @@ -637,7 +637,7 @@ msdosfs_mkdire(const char *path, struct denode *pdep, fsnode *node) { return dep; bad: - clusterfree(pmp, newcluster, NULL); + clusterfree(pmp, newcluster); bad2: errno = error; return NULL;