NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/54598: mount ntfs panic
The following reply was made to PR kern/54598; it has been noted by GNATS.
From: "J. Hannken-Illjes" <hannken%eis.cs.tu-bs.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/54598: mount ntfs panic
Date: Sun, 13 Oct 2019 10:46:00 +0200
--Apple-Mail=_7736D1A9-8622-4179-A730-149A3CFDCA9A
Content-Type: multipart/mixed;
boundary="Apple-Mail=_781B5E70-6FB5-424C-BC70-36ED85885172"
--Apple-Mail=_781B5E70-6FB5-424C-BC70-36ED85885172
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Please try the attached diff. It should fix this PR.
--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig
--Apple-Mail=_781B5E70-6FB5-424C-BC70-36ED85885172
Content-Disposition: attachment;
filename=ntfs.diff
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="ntfs.diff"
Content-Transfer-Encoding: 7bit
ntfs_vflush
It is not possible to call vflush() from xxx_mount().
Replace with a vnode iterator and use vrecycle().
diff -r 42546c91626f -r 04476c96f69d sys/fs/ntfs/ntfs_vfsops.c
--- sys/fs/ntfs/ntfs_vfsops.c
+++ sys/fs/ntfs/ntfs_vfsops.c
@@ -322,6 +322,7 @@ ntfs_mountfs(struct vnode *devvp, struct
dev_t dev = devvp->v_rdev;
int error, i;
struct vnode *vp;
+ struct vnode_iterator *marker;
ntmp = NULL;
@@ -471,9 +472,13 @@ out1:
if (ntmp->ntm_sysvn[i])
vrele(ntmp->ntm_sysvn[i]);
- if (vflush(mp, NULLVP, 0)) {
- dprintf(("ntfs_mountfs: vflush failed\n"));
+ vfs_vnode_iterator_init(mp, &marker);
+ while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
+ if (vrecycle(vp))
+ continue;
+ panic("%s: cannot recycle vnode %p", __func__, vp);
}
+ vfs_vnode_iterator_destroy(marker);
out:
spec_node_setmountedfs(devvp, NULL);
if (bp)
ntfs_loadntnode
When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.
Should fix PR kern/54598: mount ntfs panic
diff -r eef88ca51266 -r 4fe2b5ac31e9 sys/fs/ntfs/ntfs_subr.c
--- sys/fs/ntfs/ntfs_subr.c
+++ sys/fs/ntfs/ntfs_subr.c
@@ -271,6 +271,8 @@ ntfs_loadntnode(struct ntfsmount *ntmp,
struct buf *bp;
daddr_t bn;
off_t boff;
+ size_t resid, l;
+ char *data;
dprintf(("%s: read system node\n", __func__));
@@ -281,17 +283,26 @@ ntfs_loadntnode(struct ntfsmount *ntmp,
boff = ntfs_cntob(ntmp->ntm_mftcn) +
ntfs_bntob(ntmp->ntm_bpmftrec) * ip->i_number;
bn = ntfs_cntobn(ntfs_btocn(boff));
- off = ntfs_btocnoff(boff);
+ boff = ntfs_btocnoff(boff);
+ resid = ntfs_bntob(ntmp->ntm_bpmftrec);
+ data = (char *)mfrp;
+ while (resid > 0) {
+ l = MIN(resid, ntfs_cntob(1) - boff);
- error = bread(ntmp->ntm_devvp, bn, ntfs_cntob(1),
- 0, &bp);
- if (error) {
- printf("%s: BREAD FAILED\n", __func__);
- goto out;
+ error = bread(ntmp->ntm_devvp, bn, ntfs_cntob(1),
+ 0, &bp);
+ if (error) {
+ printf("%s: BREAD FAILED\n", __func__);
+ goto out;
+ }
+ memcpy(data, (char *)bp->b_data + boff, l);
+ bqrelse(bp);
+
+ bn += ntfs_cntobn(1);
+ boff = 0;
+ data += l;
+ resid -= l;
}
- memcpy(mfrp, (char *)bp->b_data + off,
- ntfs_bntob(ntmp->ntm_bpmftrec));
- bqrelse(bp);
} else {
struct vnode *vp;
--Apple-Mail=_781B5E70-6FB5-424C-BC70-36ED85885172--
--Apple-Mail=_7736D1A9-8622-4179-A730-149A3CFDCA9A
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE2BL3ha7Xao4WUZVYKoaVJdNr+uEFAl2i5EgACgkQKoaVJdNr
+uGdCgf/dQwJBGexAQKj4XME/g/lCL08uD7KgrPtqT/8lgjnU10FEmo18BxALwc5
fxFDpxC82xzNZQgMlUwm0ZPnhd3LL7gjUAmMqzUsHIAIEI4HNIlWx1Gz3g22iDTB
RM+ZDOlp5TPbPPaFCinKN8QJmzPcGB1wexH+FZJXnQkM5nVLlHCErxQDjvwlIdFy
4QbnnnOoX8KBKvGB3hceInj2XXDJ9JehMvLqTibBUxBRu/+3HnWd1NrW9IWx/RTk
/TSKfq2FN4rhT1daemDP9XNHjvZr8YLcELvH+fMrtur8iuO5skOK45w5sYXk1V3f
OHTeo+7UOOuW4ob79j9exSWyiWhjNA==
=T1AV
-----END PGP SIGNATURE-----
--Apple-Mail=_7736D1A9-8622-4179-A730-149A3CFDCA9A--
Home |
Main Index |
Thread Index |
Old Index