checkout: Don't hardlink zero sized files
Alternative to https://github.com/ostreedev/ostree/pull/2197 Python's (usually) zero-sized `__init__.py` files can provoke us hitting the hardlink limits on some filesystems (`EMLINK`). At least one Fedora rpm-ostree user hit this. The benefits of hardlinking here are quite marginal; lots of hardlinks can behave suboptimally in particular filesystems like BTRFS too. This builds on prior code which made this an option, introduced in https://github.com/ostreedev/ostree/commit/673cacd633f9d6b653cdea530657d3e780a41bbd Now we just do it uncondtionally. Also this provoked a different bug in a very obscure user mode checkout case; when the "real" permissions were different from the "physical" permissions, we would still hardlink. Fix the test case for this.
This commit is contained in:
1 parent
6950a98099
commit
558720e7aa
5 files changed
+23
-17
No files matched your search
@@ -637,8 +637,12 @@ checkout_one_file_at (OstreeRepo *repo,
|
||||
|
||||
need_copy = FALSE;
|
||||
}
|
||||
else if ((options->force_copy_zerosized && is_reg_zerosized) || override_user_unreadable)
|
||||
else if (is_reg_zerosized || override_user_unreadable)
|
||||
{
|
||||
/* In https://github.com/ostreedev/ostree/commit/673cacd633f9d6b653cdea530657d3e780a41bbd we
|
||||
* made this an option, but in order to avoid hitting EMLINK, we now force copy zerosized
|
||||
* files unconditionally.
|
||||
*/
|
||||
need_copy = TRUE;
|
||||
}
|
||||
else if (!options->force_copy)
|
||||
|
||||
@@ -84,7 +84,7 @@ static GOptionEntry options[] = {
|
||||
{ "from-file", 0, 0, G_OPTION_ARG_STRING, &opt_from_file, "Process many checkouts from input file", "FILE" },
|
||||
{ "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" },
|
||||
{ "require-hardlinks", 'H', 0, G_OPTION_ARG_NONE, &opt_require_hardlinks, "Do not fall back to full copies if hardlinking fails", NULL },
|
||||
{ "force-copy-zerosized", 'z', 0, G_OPTION_ARG_NONE, &opt_force_copy_zerosized, "Do not hardlink zero-sized files", NULL },
|
||||
{ "force-copy-zerosized", 'z', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_force_copy_zerosized, "Do not hardlink zero-sized files", NULL },
|
||||
{ "force-copy", 'C', 0, G_OPTION_ARG_NONE, &opt_force_copy, "Never hardlink (but may reflink if available)", NULL },
|
||||
{ "bareuseronly-dirs", 'M', 0, G_OPTION_ARG_NONE, &opt_bareuseronly_dirs, "Suppress mode bits outside of 0775 for directories (suid, world writable, etc.)", NULL },
|
||||
{ "skip-list", 0, 0, G_OPTION_ARG_FILENAME, &opt_skiplist_file, "File containing list of files to skip", "FILE" },
|
||||
|
||||
Reference in new issue
Block a user