Whamcloud - gitweb
e2fsck: allow deleting or zeroing shared blocks
authorAndreas Dilger <andreas.dilger@intel.com>
Thu, 12 Apr 2012 23:32:53 +0000 (17:32 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 15 Dec 2022 18:49:57 +0000 (11:49 -0700)
commit0174ffb6a90703af8eba0509a059ba41f56ed560
tree3c352af48d8e8ff126f6cc44d83d66eb8f9bc73b
parente1e7ffc2e90db6912898a8f296e95f6640203197
e2fsck: allow deleting or zeroing shared blocks

E2fsck fixes files that are found to be sharing blocks by cloning
the shared blocks and giving each file a private copy in pass 1D.

Allowing all files claiming the shared blocks to have copies can
inadvertantly bypass access restrictions.  Deleting all the files,
zeroing the cloned blocks, or placing the files in the /lost+found
directory after cloning may be preferable in some secure environments.

The following patches implement config file and command line options
in e2fsck that allow pass 1D behavior to be tuned according to site
policy.  It adds two extended options and config file counterparts.
On the command line:

 -E clone=dup|zero

    Select the block cloning method.  "dup" is old behavior,
    and is the default.  "zero" is a new method that substitutes
    zero-filled blocks for the shared blocks in all the files
    that claim them.

 -E shared=preserve|lost+found|delete

    Select the disposition of files containing shared blocks.
    "preserve" is the old behavior which remains the default.
    "lost+found" causes files to be unlinked after cloning so
    they will be reconnected to /lost+found in pass 3.
    "delete" skips cloning entirely and simply deletes the files.

In the config file:
  [options]
      clone=dup|zero
      shared=preserve|lost+found|delete

Change-Id: I132a3122076b5c68c4f9ea8c1316cb48f8d94020
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
e2fsck/e2fsck.8.in
e2fsck/e2fsck.conf.5.in
e2fsck/e2fsck.h
e2fsck/pass1b.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c