summaryrefslogtreecommitdiff
path: root/cmds-scrub.c
Commit message (Collapse)AuthorAge
...
* btrfs-progs: fix close of error fd in scrub cancelEric Sandeen2013-02-27
| | | | | | | | If we retry opening the mountpoint and fail, we'll call close on a filehandle w/ value -1. Rearrange so the retry uses the same open and same error handling. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: don't use closed fdEric Sandeen2013-02-05
| | | | | | | | | | In the case that btrfs scrub cancel is given a device name, we close the file handle, and then pass it to check_mounted_where() which eventually preads from that (now closed) fd. Fix the logic so that we close & re-open the discovered mountpoint properly. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: don't double-close prg_fdEric Sandeen2013-02-05
| | | | | | | | | If scrub start discovers that scrub is already running, we need to set prg_fd to -1 before goto out, or we'll try to close it again in the error path. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: scrub can leak fd 0Zach Brown2013-02-05
| | | | | | < 0 is returned for errors opening the file, this code could leak fd 0. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: fix scrub socket leakZach Brown2013-02-05
| | | | | | | | If connection fails the socket is leaked when the status file is used instead. Close it to trivially cut down on fd use and to bring down the noise in static code analysis. Signed-off-by: Zach Brown <zab@redhat.com>
* Btrfs-progs: make two utility functions globally availableStefan Behrens2013-01-30
| | | | | | | | Two convenient utility functions that have so far been local to scrub are moved to utils.c. They will be used in the device stats code in a following commit. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs-progs: bugfix for scrubbing single devicesArne Jansen2013-01-18
| | | | | | | | | | Scrub can be invoked to scrub only a single device of a (mounted) filesystem. The code determines whether the given path is a mountpoint of a filesystem by issueing a btrfs-specific ioctl to it. Only in case of EINVAL it assumed it may be a device, all other errnos just caused it fail, but some devices (correctly) return ENOTTY. This patch adds this to the error check. Signed-off-by: Arne Jansen <sensille@gmx.net>
* btrfs-progs: Fix getopt on arm platformsLluis Batlle i Rossell2013-01-17
| | | | | | | There, 'char' is unsigned, so once assigned '-1' from getopt, it gets the value 255. Then, it compared to '-1' gives false. Signed-off-by: Lluis Batlle i Rossell <viric@viric.name>
* Btrfs-progs: Fix compiler warnings on PPC64Wade Cline2013-01-17
| | | | | | | | | | | | | | | | The kernel uses unsigned long long for u64, but PPC64 uses unsigned long by default. This results in compilation warnings such as: print-tree.c:333: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'u64' To fix this, the macro __KERNEL__ needs to be defined before including the file <asm/types.h>. This can be done by defining the macro in "kerncompat.h" and making it the first included file in the relevant header files; this fixes the compiler warnings on PPC64. Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Wade Cline <clinew@linux.vnet.ibm.com>
* scrub_fs_info( ) file handle leakingGoffredo Baroncelli2012-07-03
| | | | | | | | | The function scrub_fs_info( ) closes and reopen a file handle passed as argument, when a caller uses the file handle even after the call. The function scrub_fs_info( ) is updated to remove the file handle argument, and instead uses a private own file handle. The callers are updated to not pass the argument.
* Btrfs-progs: allow multi-line command group synopsisIlya Dryomov2012-02-08
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: switch all existing commands to a new parserIlya Dryomov2012-02-03
| | | | | | | The new infrastructure offloads checking number of arguments passed to a command to individual command handlers. Fix them up accordingly. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Btrfs-progs: rearrange files in the repoIlya Dryomov2012-02-03
Separate every command group into its own file (cmds_<group>.c) and rearrange includes. Remove btrfs_cmds.c. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>