summaryrefslogtreecommitdiff
path: root/sys/geom/label
Commit message (Collapse)AuthorAgeFilesLines
* Make g_attach() return ENXIO for orphaned providers; update variousEdward Tomasz Napierala2020-10-181-1/+3
| | | | | | | | | | | | | classes to add missing error checking. Reviewed by: imp MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26658 Notes: svn path=/head/; revision=366811
* geom: clean up empty lines in .c and .h filesMateusz Guzik2020-09-014-4/+0
| | | | Notes: svn path=/head/; revision=365226
* geom_label: Make glabel labels more trivial by separating the tastingXin LI2020-07-2611-71/+67
| | | | | | | | | | | | | | | | routines out. While there, also simplify the creation of label paths a little bit by requiring the / suffix for label directory prefixes (ld_dir renamed to ld_dirprefix to indicate the change) and stop defining macros for these when they are only used once. Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25597 Notes: svn path=/head/; revision=363537
* Consistently use gctl_get_provider instead of home-grown variants.Xin LI2020-07-221-12/+2
| | | | | | | | | Reviewed by: cem, imp MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D25739 Notes: svn path=/head/; revision=363411
* sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".Xin LI2020-07-091-4/+4
| | | | | | | | | Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25565 Notes: svn path=/head/; revision=363034
* Move the pointers stored in the superblock into a separateKirk McKusick2020-06-191-0/+1
| | | | | | | | | | | | | | | | | fs_summary_info structure. This change was originally done by the CheriBSD project as they need larger pointers that do not fit in the existing superblock. This cleanup of the superblock eases the task of the commit that immediately follows this one. Suggested by: brooks Reviewed by: kib PR: 246983 Sponsored by: Netflix Notes: svn path=/head/; revision=362358
* Revert r361838Conrad Meyer2020-06-061-32/+6
| | | | | | | Reported by: delphij Notes: svn path=/head/; revision=361870
* geom_label: Use provider aliasing to alias upstream geomsConrad Meyer2020-06-051-6/+32
| | | | | | | | | | | | | | | | | | | | | | For synthetic aliases (just pseudonyms inferred from metadata like GPT or UFS labels, GPT UUIDs, etc), use the GEOM provider aliasing system to create a symlink to the real device instead of creating an independent device. This makes it more clear which labels and devices correspond, and we can safely have multiple labels to a single device accessed at once. The confusingly named geom_label on-disk construct continues to behave identically to how it did before. This requires teaching GEOM's provider aliasing about the possibility that aliases might be added later in time, and GEOM's devfs interaction layer not to worry about existing aliases during retaste. Discussed with: imp Relnotes: sure, if we don't end up reverting it Differential Revision: https://reviews.freebsd.org/D24968 Notes: svn path=/head/; revision=361838
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-262-2/+4
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* GEOM label: strip leading/trailing space synthesizing devfs namesConrad Meyer2020-01-181-0/+16
| | | | | | | | | | | %20%20%20 is ugly and doesn't really help make human-readable devfs names. PR: 243318 Reported by: Peter Eriksson <pen AT lysator.liu.se> Relnotes: yes Notes: svn path=/head/; revision=356861
* GEOM: Reduce unnecessary log interleaving with sbufsConrad Meyer2019-08-077-10/+8
| | | | | | | | | | | | | | | Similar to what was done for device_printfs in r347229. Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an sbuf; documented in g_bio.9. Reviewed by: markj Discussed with: rlibby Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21165 Notes: svn path=/head/; revision=350694
* Ignore UFS/FFS superblock check hash failures so as to allow a higherKirk McKusick2019-08-061-2/+2
| | | | | | | | | | | level in the filesystem stack to decide what to do about them. Reported by: Peter Holm Tested by: Peter Holm Sponsored by: Netflix Notes: svn path=/head/; revision=350653
* Support device-independent labels for geom_flashmap slices.Ian Lepore2019-03-243-0/+79
| | | | | | | | | | | | | | | | | While geom_flashmap has always supported label names for its slices, it does so by appending "s.labelname" to the provider device name, meaning you still have to know the name and unit of the hardware device to use the labels. These changes add support for device-independent geom_flashmap labels, using the standard geom_label infrastructure. geom_flashmap now creates a softc struct attached to its geom, and as it creates slices it stores the label into an array in the softc. The new geom_label_flashmap uses those labels when tasting a geom_flashmap provider. Differential Revision: https://reviews.freebsd.org/D19535 Notes: svn path=/head/; revision=345480
* Normally when an attempt is made to mount a UFS/FFS filesystem whoseKirk McKusick2018-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | superblock has a check-hash error, an error message noting the superblock check-hash failure is printed and the mount fails. The administrator then runs fsck to repair the filesystem and when successful, the filesystem can once again be mounted. This approach fails if the filesystem in question is a root filesystem from which you are trying to boot. Here, the loader fails when trying to access the filesystem to get the kernel to boot. So it is necessary to allow the loader to ignore the superblock check-hash error and make a best effort to read the kernel. The filesystem may be suffiently corrupted that the read attempt fails, but there is no harm in trying since the loader makes no attempt to write to the filesystem. Once the kernel is loaded and starts to run, it attempts to mount its root filesystem. Once again, failure means that it breaks to its prompt to ask where to get its root filesystem. Unless you have an alternate root filesystem, you are stuck. Since the root filesystem is initially mounted read-only, it is safe to make an attempt to mount the root filesystem with the failed superblock check-hash. Thus, when asked to mount a root filesystem with a failed superblock check-hash, the kernel prints a warning message that the root filesystem superblock check-hash needs repair, but notes that it is ignoring the error and proceeding. It does mark the filesystem as needing an fsck which prevents it from being enabled for writing until fsck has been run on it. The net effect is that the reboot fails to single user, but at least at that point the administrator has the tools at hand to fix the problem. Reported by: Rick Macklem (rmacklem@) Discussed with: Warner Losh (imp@) Sponsored by: Netflix Notes: svn path=/head/; revision=341608
* Annotate geom modules with MODULE_VERSIONKyle Evans2018-04-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | GEOM ELI may double ask the password during boot. Once at loader time, and once at init time. This happens due a module loading bug. By default GEOM ELI caches the password in the kernel, but without the MODULE_VERSION annotation, the kernel loads over the kernel module, even if the GEOM ELI was compiled into the kernel. In this case, the newly loaded module purges/invalidates/overwrites the GEOM ELI's password cache, which causes the double asking. MFC Note: There's a pc98 component to the original submission that is omitted here due to pc98 removal in head. This part will need to be revived upon MFC. Reviewed by: imp Submitted by: op Obtained from: opBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14992 Notes: svn path=/head/; revision=332387
* Squash error from geom by sizing ident strings to DISK_IDENT_SIZE.Sean Bruno2018-04-051-1/+1
| | | | | | | | | | | | | | | Display attribute in future error strings and differentiate g_handleattr() error messages for ease of debugging in the future. "g_handleattr: md1 bio_length 24 strlen 31 -> EFAULT" Reported by: swills Reviewed by: imp cem avg Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14962 Notes: svn path=/head/; revision=332070
* When freeing a superblock returned by ffs_sbget, be sure to alsoKirk McKusick2018-03-241-2/+3
| | | | | | | | | | free the superblock summary information. Reported by: Peter Holm (pho@) Tested by: Peter Holm (pho@) Notes: svn path=/head/; revision=331491
* Remove unneeded variable which was introduced in r328472.Mariusz Zaborski2018-03-181-3/+1
| | | | | | | Pointed out by: pjd@ Notes: svn path=/head/; revision=331118
* g_label_ufs: Fix typo from r330264Conrad Meyer2018-03-021-1/+1
| | | | | | | | Reported by: O. Hartmann <o.hartmann AT walstatt.org> Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=330270
* This change is some refactoring of Mark Johnston's changes in r329375Kirk McKusick2018-03-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to fix the memory leak that I introduced in r328426. Instead of trying to clear up the possible memory leak in all the clients, I ensure that it gets cleaned up in the source (e.g., ffs_sbget ensures that memory is always freed if it returns an error). The original change in r328426 was a bit sparse in its description. So I am expanding on its description here (thanks cem@ and rgrimes@ for your encouragement for my longer commit messages). In preparation for adding check hashing to superblocks, r328426 is a refactoring of the code to get the reading/writing of the superblock into one place. Unlike the cylinder group reading/writing which ends up in two places (ffs_getcg/ffs_geom_strategy in the kernel and cgget/cgput in libufs), I have the core superblock functions just in the kernel (ffs_sbfetch/ffs_sbput in ffs_subr.c which is already imported into utilities like fsck_ffs as well as libufs to implement sbget/sbput). The ffs_sbfetch and ffs_sbput functions take a function pointer to do the actual I/O for which there are four variants: ffs_use_bread / ffs_use_bwrite for the in-kernel filesystem g_use_g_read_data / g_use_g_write_data for kernel geom clients ufs_use_sa_read for the standalone code (stand/libsa/ufs.c but not stand/libsa/ufsread.c which is size constrained) use_pread / use_pwrite for libufs Uses of these interfaces are in the UFS filesystem, geoms journal & label, libsa changes, and libufs. They also permeate out into the filesystem utilities fsck_ffs, newfs, growfs, clri, dump, quotacheck, fsirand, fstyp, and quot. Some of these utilities should probably be converted to directly use libufs (like dumpfs was for example), but there does not seem to be much win in doing so. Tested by: Peter Holm (pho@) Notes: svn path=/head/; revision=330264
* Fix a memory leak introduced in r328426.Mark Johnston2018-02-161-1/+6
| | | | | | | | | | | | | | ffs_sbget() may return a superblock buffer even if it fails, so the caller must be prepared to free it in this case. Moreover, when tasting alternate superblock locations in a loop, ffs_sbget()'s readfunc callback must free the previously allocated buffer. Reported and tested by: pho Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D14390 Notes: svn path=/head/; revision=329375
* After r328426, g_label depends on UFS (option FFS) code to read UFSXin LI2018-02-031-0/+2
| | | | | | | | | | | | | | | | | superblock, and the kernel will fail to link when UFS is not built in. This commit makes it depend on a small portion of FFS bits and thereby fixes build for this situation. This is intended as an interim bandaid, and the actual superblock reading code should probably be made independent of UFS, so we do not need to depend on it (see kib@'s comment in the review for details), and we will revisit this once the superblock check hashes are all in place. Differential Revision: https://reviews.freebsd.org/D14092 Notes: svn path=/head/; revision=328829
* Don't truncate name of glabel.Mariusz Zaborski2018-01-271-1/+7
| | | | | | | | | | If it's to long just report that. Reviewed by: trasz@ Differential Revision: https://reviews.freebsd.org/D13746 Notes: svn path=/head/; revision=328472
* Refactoring of reading and writing of the UFS/FFS superblock.Kirk McKusick2018-01-261-83/+43
| | | | | | | | | | | | | | | Specifically reading is done if ffs_sbget() and writing is done in ffs_sbput(). These functions are exported to libufs via the sbget() and sbput() functions which then used in the various filesystem utilities. This work is in preparation for adding subperblock check hashes. No functional change intended. Reviewed by: kib Notes: svn path=/head/; revision=328426
* sys/geom: adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2711-0/+22
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326270
* Relax checking if the privider size matches size recorded in theMaxim Sobolev2016-07-181-8/+34
| | | | | | | | | | | | | | | | superblock, allowing provider to be bit bigger, i.e. have some extra padding after the FS image. That in some cases might be a side-effect of using CLOOP format which enforces certain block size and trying to compress image that is not exactly the number of those blocks in size. The UFS itself does not have any issues mounting such padded file systems, so it's what GEOM_LABEL should do. Submitted by: @mizhka_gmail.com Differential Revision: https://reviews.freebsd.org/D6208 Notes: svn path=/head/; revision=302985
* Fix off-by-one error in fstyp(8) and geom_label(4) that made them useEdward Tomasz Napierala2015-06-184-18/+19
| | | | | | | | | | | | | | a single space (" ") as a CD9660 label name when no label was present. Similar problem was also present in msdosfs label recognition. PR: 200828 Differential Revision: https://reviews.freebsd.org/D2830 Reviewed by: asomers@, emaste@ MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=284582
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-282-5/+2
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-272-2/+5
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-272-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Make r242379 - the fix for UFS labels disappearing after resizingEdward Tomasz Napierala2014-05-051-2/+4
| | | | | | | | | | | the provider - also apply to UFS1 filesystems. This should help with resizing filesystems created by makefs(8), which still uses UFS1. Tested by: jmg@ Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=265351
* An all-or-nothing approach to labels isn't flexible enough. EmbeddedMarcel Moolenaar2014-04-061-2/+6
| | | | | | | | | | | systems need fine-grained control over what's in and what's out. That's ideal. For now, separate GPT labels from the rest and allow g_label to be built with just GPT labels. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=264185
* Fix build with gcc by spelling unused format string as "unused" instead of NULL.Edward Tomasz Napierala2013-10-191-1/+1
| | | | | | | MFC after: 29 days Notes: svn path=/head/; revision=256766
* Make geom_label(4) resize-aware. This fixes a situation when "gpart resize"Edward Tomasz Napierala2013-10-181-0/+12
| | | | | | | | | | | | would resize a partition, but label providers - e.g. /dev/gptid/XXX - would stay the same size. Reviewed by: mav MFC after: 1 month Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=256724
* - Use int8_t type for the mftrecsz field in g_label_ntfs. char typeStanislav Sedov2013-05-051-3/+4
| | | | | | | | | | | used previously caused probe failure on platforms where char is unsigned (e.g. ARM), as mftrecsz can be negative. Submitted by: Ilya Bakulin <ilya@bakulin.de> MFC after: 2 weeks Notes: svn path=/head/; revision=250264
* Comment typo fix.Ivan Voras2013-04-161-2/+2
| | | | | | | Is aware of the importance of comments: dim Notes: svn path=/head/; revision=249571
* Fix the buffer-overflow-fixing fixes.Ivan Voras2013-04-161-15/+19
| | | | | | | | | Pointy-hat to: me, for not realizing snprintf() is available in kernel. Thanks to: jh, for bringing me the good news of snprintf(), Pawel Worach, for noting that the panic can be provoked in i386 and not in amd64 Notes: svn path=/head/; revision=249564
* Introduce glabel labels based on GEOM ident attributes. In this initialIvan Voras2013-04-153-1/+87
| | | | | | | | | | | implementation, error on the side of conservatism and only create labels for GEOMs of classes DISK and MULTIPATH. Discussed with: trasz Approved by: silence from freebsd-geom@ Notes: svn path=/head/; revision=249508
* g_label_ntfs_taste: Abort taste is recsize == 0Jean-Sébastien Pédron2013-03-081-1/+1
| | | | | | | | | | This will avoid a 0-byte read (in g_read_data()) leading to a panic, if previously read data are erroneous. Suggested by: John-Mark Gurney <jmg@funkthat.com> Notes: svn path=/head/; revision=248058
* g_label_ntfs.c: Mark structures as __packedJean-Sébastien Pédron2013-03-051-3/+3
| | | | | | | | | Without this, read data is mis-interpreted. This could trigger a panic, as was the case on one computer where computed "recsize" was zero, leading to a call to g_read_page() asking for 0 bytes. Notes: svn path=/head/; revision=247837
* Remove ntfs headers dependency for g_label_ntfs.c by redefining theAttilio Rao2013-03-021-14/+65
| | | | | | | | | used structs and values. This patch is not targeted for MFC. Notes: svn path=/head/; revision=247662
* Mangle label names containing spaces, non-printable characters '%' orJaakko Heinonen2012-12-221-0/+23
| | | | | | | | | | | | '"'. Mangling is only done for label names read from file system metadata. Encoding resembles URL encoding. For example, the space character becomes %20. Help by: kib Discussed with: imp, kib, pjd Notes: svn path=/head/; revision=244585
* - Don't pass geom and provider names as format strings.Jaakko Heinonen2012-11-201-1/+1
| | | | | | | | | | - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Reviewed by: pjd Notes: svn path=/head/; revision=243333
* Fix problem with geom_label(4) not recognizing UFS labels on filesystemsEdward Tomasz Napierala2012-10-301-1/+2
| | | | | | | | | | | | | | | | | | | | | extended using growfs(8). The problem here is that geom_label checks if the filesystem size recorded in UFS superblock is equal to the provider (i.e. device) size. This check cannot be removed due to backward compatibility. On the other hand, in most cases growfs(8) cannot set fs_size in the superblock to match the provider size, because, differently from newfs(8), it cannot recompute cylinder group sizes. To fix this problem, add another superblock field, fs_providersize, used only for this purpose. The geom_label(4) will attach if either fs_size (filesystem created with newfs(8)) or fs_providersize (filesystem expanded using growfs(8)) matches the device size. PR: kern/165962 Reviewed by: mckusick Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=242379
* It seems that it is preferable to keep support for glabel also forAttilio Rao2012-10-182-0/+2
| | | | | | | | | | | | filesystems that we don't support natively. Revert part of r241636 to do so. This patch is not targeted for MFC. Requested by: gleb, jhb Notes: svn path=/head/; revision=241706
* Disconnect non-MPSAFE NTFS from the build in preparation for droppingAttilio Rao2012-10-172-2/+0
| | | | | | | | | | | | | | | | | GIANT from VFS. This code is particulary broken and fragile and other in-kernel implementations around, found in other operating systems, don't really seem clean and solid enough to be imported at all. If someone wants to reconsider in-kernel NTFS implementation for inclusion again, a fair effort for completely fixing and cleaning it up is expected. In the while NTFS regular users can use FUSE interface and ntfs-3g port to work with their NTFS partitions. This is not targeted for MFC. Notes: svn path=/head/; revision=241636
* Revert r235918 for now and add comment explaining the reason for theEdward Tomasz Napierala2012-05-251-3/+9
| | | | | | | size check. Notes: svn path=/head/; revision=235989
* Make g_label(4) ignore provider size when looking for UFS labels.Edward Tomasz Napierala2012-05-241-5/+3
| | | | | | | | | | | Without it, it fails to create labels for filesystems resized by growfs(8). PR: kern/165962 Submitted by: Olivier Cochard-Labbe <olivier at cochard dot me> Notes: svn path=/head/; revision=235918
* Include sys/sbuf.h directly.Andrey V. Elsukov2011-07-111-0/+1
| | | | | | | Reviewed by: pjd Notes: svn path=/head/; revision=223921
* When checking existence of providers skip those which are orphaned.Andrey V. Elsukov2011-05-041-0/+2
| | | | | | | | PR: kern/132273 MFC after: 2 week Notes: svn path=/head/; revision=221433