356579 |
10-Jan-2020 |
mav |
MFC r356138: Fix GEOM_UZIP orphanization.
Previous code destroyed softc even with provider still open, that resulted in panic under load. This change postpones the free till the final close, when we know for sure there will be no more I/O requests. |
345344 |
20-Mar-2019 |
kib |
MFC r344479 (by sobomax), r344605: Modularize xz. |
343605 |
31-Jan-2019 |
avos |
MFC r343473: geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced
PR: 203499 Submitted by: <chadf@triularity.org>
MFC r343475: geom_uzip(4): set 'gp != NULL' assertion on top of the function
There was yet another access to this variable in g_trace() few lines upper.
PR: 203499 Reported by: cem |
332640 |
17-Apr-2018 |
kevans |
MFC r332387: Annotate geom modules with MODULE_VERSION
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.
This MFC commit differs slightly from head, due to pc98 removal. These changes were trivial and should be obvious. |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
302284 |
29-Jun-2016 |
sobomax |
1.Improve handling around last compressed block of the file, which is necessary because CLOOP format lacks explicit EOF or length, so that in the presence of padding or when the CLOOP is put onto a larger partition upper level provider size may be larger. Bound amount of extra data that we might touch to the max length of the compressed block and detect zero-padding in the last cluster, which when sector is all-zero might cause us to emit bogus I/O error after decompression of that fails. To not make code any more complicated that it needs to be deal with it in lazy-manner, i.e. when we first access that specific cluster.
This change also fixes stupid mistake in the LZMA code, inherited from geom_lzma, which does not share length of the output buffer buffer with the decompression routine, so that in the presence of corrupted or purposedly tailored data may easily cause heap overflow and kernel memory corruption.
Beef up validation of the CLOOP TOC by checking that lengths of all but the last compressed clusters match upper limit set by the decompressor and improve some error diagnostic output while I am here.
2.Add kern.geom.uzip.attach_to tunable to artifically limit attaching uzip to certain devices in the dev tree only.
For example the following only makes us attaching to the GPT labels:
kern.geom.uzip.attach_to="gpt/*"
3.Add kern.geom.uzip.noattach_to, which does opposite to the (2) above, i.e. prevents geom_uzip from tasting / attaching to providers matching some pattern. By default we don't attach to our own kind, i.e. kern.geom.uzip.noattach_to="*.uzip". It saves us quite some CPU cycles, esp on low-end embedded systems.
Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D7013
|
299195 |
06-May-2016 |
sobomax |
Add missing include "opt_geom.h" to make GEOM_UZIP_DEBUG option working, also rename enum member so it does not conflict with GEOM_UZIP option name.
Submitted by: mizhka@gmail.com Differential Revision: https://reviews.freebsd.org/D6207
|
298649 |
26-Apr-2016 |
pfg |
sys: extend use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
|
298619 |
26-Apr-2016 |
sobomax |
Relax TOC offsets checking somewhat, allowing offset pointing to the next byte past EOF to denote zero-block(s) at the very end of the file.
|
298502 |
23-Apr-2016 |
sobomax |
o Fix handling of images with compression block sizes comparable to MAXPHYS.
o Improve debug somewhat;
o Convert "BUG BUG BUG message" into a proper KASSERT.
|
295952 |
24-Feb-2016 |
adrian |
Fixes to make it compile under gcc-4.2.
|
295943 |
24-Feb-2016 |
sobomax |
Improve mkuzip(8) and geom_uzip(4), merge in LZMA support from mkulzma(8) and geom_uncompress(4):
1. mkuzip(8):
- Proper support for eliminating all-zero blocks when compressing an image. This feature is already supported by the geom_uzip(4) module and CLOOP format in general, so it's just a matter of making mkuzip(8) match. It should be noted, however that this feature while it sounds great, results in very slight improvement in the overall compression ratio, since compressing default 16k all-zero block produces only 39 bytes compressed output block, which is 99.8% compression ratio. With typical average compression ratio of amd64 binaries and data being around 60-70% the difference between 99.8% and 100.0% is not that great further diluted by the ratio of number of zero blocks in the uncompressed image to the overall number of blocks being less than 0.5 (typically). However, this may be important from performance standpoint, so that kernel are not spinning its wheels decompressing those empty blocks every time this zero region is read. It could also be important when you create huge image mostly filled with zero blocks for testing purposes.
- New feature allowing to de-duplicate output image. It turns out that if you twist CLOOP format a bit you can do that as well. And unlike zero-blocks elimination, this gives a noticeable improvement in the overall compression ratio, reducing output image by something like 3-4% on my test UFS2 3GB image consisting of full FreeBSD base system plus some of the packages (openjdk, apache etc), about 2.3GB worth of file data (800+MB compressed). The only caveat is that images created with this feature "on" would not work on older versions of FeeBSDxi kernel, hence it's turned off by default.
- provide options to control both features and document them in manual page.
- merge in all relevant LZMA compression support from the mkulzma(8), add new option to select between both.
- switch license from ad-hoc beerware into standard 2-clause BSD.
2. geom_uzip(4):
- implement support for de-duplicated images;
- optimize some code paths to handle "all-zero" blocks without reading any compressed data;
- beef up manual page to explain that geom_uzip(4) is not limited only to md(4) images. The compressed data can be written to the block device and accessed directly via magic of GEOM(4) and devfs(4), including to mount root fs from a compressed drive.
- convert debug log code from being compiled in conditionally into being present all the time and provide two sysctls to turn it on or off. Due to intended use of the module, it can be used in environments where there may not be a luxury to put new kernel with debug code enabled. Having those options handy allows debug issues without as much problem by just having access to serial console or network shell access to a box/appliance. The resulting additional CPU cycles are just few int comparisons and branches, and those are minuscule when compared to data decompression which is the main feature of the module.
- hopefully improve robustness and resiliency of the geom_uzip(4) by performing some of the data validation / range checking on the TOC entries and rejecting to attach to an image if those checks fail.
- merge in all relevant LZMA decompression support from the geom_uncompress(4), enable automatically when appropriate format is indicated in the header.
- move compilation work into its own worker thread so that it does not clog g_up. This allows multiple instances work in parallel utilizing smp cores.
- document new knobs in the manual page.
Reviewed by: adrian MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D5333
|
286367 |
06-Aug-2015 |
ngie |
Make some debug printf's into DPRINTF's to reduce noise on attach/detach
Differential Revision: https://reviews.freebsd.org/D3306 MFC after: 1 week Reviewed by: loos Sponsored by: EMC / Isilon Storage Division
|
281855 |
22-Apr-2015 |
rodrigc |
Move zlib.c from net to libkern.
It is not network-specific code and would be better as part of libkern instead. Move zlib.h and zutil.h from net/ to sys/ Update includes to use sys/zlib.h and sys/zutil.h instead of net/
Submitted by: Steve Kiernan stevek@juniper.net Obtained from: Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/28 Relnotes: yes
|
268986 |
22-Jul-2014 |
marcel |
In r264504, we prevented doing I/O for more than MAXPHYS by making the assumption that consumers would respect bio_completed and/or bio_resid to detect short reads. This assumption proved false and file corruption was the result. Create as many bios as we need to satisfy the original request. Check the cached chunk every time we need to do I/O to increase the hit rate.
Obtained from: junipre Networks, Inc. MFC after: 1 week
|
265197 |
01-May-2014 |
loos |
Fix a leak in g_uzip_taste(). After retrieve all the block offsets from the uzip image, free the last data read.
|
265194 |
01-May-2014 |
loos |
Actually the FEATURE() macro is defined on sys/sysctl.h.
Pointyhat to: loos
|
265193 |
01-May-2014 |
loos |
Some style and whitespace fixes. Reduce the difference between geom_uzip(4) and geom_uncompress(4). Now, they produce an almost clean diff(1) output.
Remove a duplicated variable from g_uncompress.c and an unnecessary header from g_uzip.c.
No functional changes.
|
264504 |
15-Apr-2014 |
marcel |
Make sure not to do I/O for more than MAXPHYS bytes. Doing so can cause problems in our providers, such as a KASSERT in md(4). We can initiate I/O for more than MAXPHYS bytes if we've been given a BIO for MAXPHYS bytes, the blocks from which we're reading couldn't be compressed and we had compression in preceeding blocks resulting in misalignment of the blocks we're trying to read relative to the sector. We're forced to round up the I/O length to make it an multiple of the sector size.
When we detect the condition, we'll reduce the block count and perform a "short" read. In g_uzip_done() we need to consider the original I/O length and stop early if we're about to deflate a block that we didn't read. By using bio_completed in the cloned BIO and not bio_length to check for this, we automatically and gracefully handle short reads that our providers may be doing on top of the short reads we may initiate ourselves.
Obtained from: Juniper Networks, Inc.
|
261586 |
07-Feb-2014 |
loos |
Fix the build with DEBUG enabled. Where possible, fix style(9) issues.
Reviewed by: bde Approved by: adrian (mentor)
|
239790 |
28-Aug-2012 |
ed |
Remove unneeded G_PF_CANDELETE flag.
This flag is only used by GEOM so it can be propagated to the character device's SI_CANDELETE. Unfortunately, SI_CANDELETE seems to do nothing.
|
238198 |
07-Jul-2012 |
trasz |
Fix orphan() methods of several GEOM classes to not assume that there is an error set on the provider. With GEOM resizing, class can become orphaned when it doesn't implement resize() method and the provider size decreases.
Reviewed by: mav Sponsored by: FreeBSD Foundation
|
227293 |
07-Nov-2011 |
ed |
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
|
219029 |
25-Feb-2011 |
netchild |
Add some FEATURE macros for various GEOM classes.
No FreeBSD version bump, the userland application to query the features will be committed last and can serve as an indication of the availablility if needed.
Sponsored by: Google Summer of Code 2010 Submitted by: kibab Reviewed by: silence on geom@ during 2 weeks X-MFC after: to be determined in last commit with code from this project
|
201645 |
06-Jan-2010 |
mav |
Change the way in which zero stripesize is handled. Instead of reporting zero stripeoffset in such case (as if device has no stripes), report offset from the beginning of the media (as if device has single infinite stripe).
This gives partitioning tools information, required to guess better partition alignment, in case if hardware doesn't report it's stripe size. For example, it should give disklabel info about odd offset made by fdisk.
|
197898 |
09-Oct-2009 |
pjd |
If provider is open for writing when we taste it, skip it for classes that depend on on-disk metadata. This was we won't attach to providers that are used by other classes. For example we don't want to configure partitions on da0 if it is part of gmirror, what we really want is partitions on mirror/foo.
During regular work it works like this: if provider is open for writing a class receives the spoiled event from GEOM and detaches, once provider is closed the taste event is send again and class can rediscover its metadata if it is still there. This doesn't work that way when new class arrives, because GEOM gives all existing providers for it to taste, also those open for writing. Classes have to decided on their own if they want to deal with such providers (eg. geom_dev) or not (classes modified by this commit).
Reported by: des, Oliver Lehmann <lehmann@ans-netz.de> Tested by: des, Oliver Lehmann <lehmann@ans-netz.de> Discussed with: phk, marcel Reviewed by: marcel MFC after: 3 days
|
168999 |
24-Apr-2007 |
simokawa |
If compressed length is zero, return a zero-filled block.
MFC after: 1 week
|
168445 |
07-Apr-2007 |
simokawa |
Fix a bug for over 4GB media.
MFC after: 3 days
|
154686 |
22-Jan-2006 |
fjoe |
Rename geom_uzip class to g_uzip in order to be consistent with the naming of other GEOM modules.
PR: 89998
|
154540 |
18-Jan-2006 |
pjd |
Fix bio leak in case of malloc(9) failure.
Found by: Coverity Prevent(tm) Coverity ID: CID794 MFC after: 3 days
|
152971 |
30-Nov-2005 |
sobomax |
Don't pass error value pointer to g_read_data(9) at all if we don't have any use of it.
Suggested by: pjd
|
152967 |
30-Nov-2005 |
sobomax |
Check for g_read_data(9) errors properly:
o The only indication of error condition is NULL value returned by the function;
o value pointed to by error argument is undefined in the case when operation completes successfully.
Discussed with: phk
|
151897 |
31-Oct-2005 |
rwatson |
Normalize a significant number of kernel malloc type names:
- Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat.
- Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters.
- Disambiguate some collisions by adding subsystem prefixes to some memory types.
- Generally prefer lower case to upper case.
- If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases.
Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
|
150735 |
29-Sep-2005 |
fjoe |
- Fix "end_blk out of range" panic when INVARIANTS. - Do not allow rw access.
Submitted by: Dario Freni <saturnero at freesbie dot org> MFC after: 3 days
|
137936 |
20-Nov-2004 |
fjoe |
Use M_ZERO to not panic in mtx_init when INVARIANTS enabled.
Submitted by: simokawa MFC after: 1 week
|
135461 |
19-Sep-2004 |
fjoe |
Use correct malloc type when freeing memory allocated by g_read_data.
PR: 71431 Submitted by: daichi
|
134958 |
08-Sep-2004 |
fjoe |
Do not compile in zlib.c. Add a dependency on module instead.
|
133640 |
13-Aug-2004 |
fjoe |
Add geom_uzip -- geom class that implements read-only compressed disks. Currently supports cloop V2.0 disk compression format. May support more formats in future.
|