Re: [PATCH 1/7] block: Add block_flush_device()

From: Jeff Garzik
Date: Mon Mar 30 2009 - 16:32:34 EST


Linus Torvalds wrote:
On Mon, 30 Mar 2009, Jeff Garzik wrote:
Indeed -- if the drive tells us it failed the cache flush, it seems
self-evident that we should be passing that failure back to userspace where
possible.

EOPNOTSUPP doesn't mean "the cache flush failed". It just means "I don't support cache flushing".

No failure anywhere. See?

Hence my statement of

the aim is simply to return zero rather than EOPNOTSUPP [...]
which is quite reasonable

I think we are all getting a bit confused whether we are discussing

(a) EOPNOTSUPP return value,
or
(b) _all possible_ blkdev_issue_flush() error return values.

As I read it, you are talking about (a) and Jens responded to (b). But maybe I am wrong.

So I have these observations:

1) fsync(2) should not return EOPNOTSUPP, if the block device does not support cache flushing. This seems to agree with Linus's patch.

2) A Linux filesystem MIGHT care about EOPNOTSUPP return value, as that return value does provide information about the future value of cache flushes.

3) However, at present NONE of the blkdev_issue_flush() callers use EOPNOTSUPP in any way. In fact, none of the current callers check the return value at all.

4) Furthermore, handling lack of cache flush support at the block layer, rather than per-filesystem, makes more sense to me.

But I am biased towards storage, so what do I know :)

5) Based on observation #3, the current kernel should be changed to return USEFUL blkdev_issue_flush() return values back to userspace. Fernando's patches head in this direction, as does my most recent file_fsync patch.

Jeff





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/