Re: how does ext3 handle no communication to storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 29, 2006 at 01:03:51PM -0400, Theodore Tso wrote:
> On Tue, Aug 29, 2006 at 11:09:35AM -0400, Sev Binello wrote:
> > From a strictly practical and immediate stand point,
> > what is the best way to handle this situation if it should occur again in 
> > the near future ?
> 
> Without any kernel patches, the best thing to do is, (a) don't restore
> the path to the device, (b) unmount the filesystem, (c) Compile the
> enclosed flushb program (also found in the e2fsprogs sources, but not
> compiled by most or all distributions), and run it: "flushb
> /dev/hdXX", and only after completing all of these steps, you can
> restore the path and do fsck of the filesystem if you are feeling
> sufficiently paranoid, and then remount it.

option (d) run blockdev --flushbufs /dev/hdXX

Ted, you may drop flushb. blockdev from util-linux can do it.

 - coywolf

> 
> I wish I could offer you something better, but that's what we have at
> the moment.
> 
> 						- Ted
> 
> /*
>  * flushb.c --- This routine flushes the disk buffers for a disk
>  *
>  * Copyright 1997, 2000, by Theodore Ts'o.
>  * 
>  * WARNING: use of flushb on some older 2.2 kernels on a heavily loaded
>  * system will corrupt filesystems.  This program is not really useful
>  * beyond for benchmarking scripts.
>  *
>  * %Begin-Header%
>  * This file may be redistributed under the terms of the GNU Public
>  * License.
>  * %End-Header%
>  */
> 
> #include <stdio.h>
> #include <string.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <sys/mount.h>
> 
> /* For Linux, define BLKFLSBUF if necessary */
> #if (!defined(BLKFLSBUF) && defined(__linux__))
> #define BLKFLSBUF	_IO(0x12,97)	/* flush buffer cache */
> #endif
> 
> const char *progname;
> 
> static void usage(void)
> {
> 	fprintf(stderr, "Usage: %s disk\n", progname);
> 	exit(1);
> }	
> 	
> int main(int argc, char **argv)
> {
> 	int	fd;
> 	
> 	progname = argv[0];
> 	if (argc != 2)
> 		usage();
> 
> 	fd = open(argv[1], O_RDONLY, 0);
> 	if (fd < 0) {
> 		perror("open");
> 		exit(1);
> 	}
> 	/*
> 	 * Note: to reread the partition table, use the ioctl
> 	 * BLKRRPART instead of BLKFSLBUF.
> 	 */
> 	if (ioctl(fd, BLKFLSBUF, 0) < 0) {
> 		perror("ioctl BLKFLSBUF");
> 		exit(1);
> 	}
> 	return 0;
> }

-- 
Coywolf Qi Hunt

_______________________________________________
Ext3-users mailing list
Ext3-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux