Re: [PATCH 40/41] union-mount: Make truncate work in all its glorious UNIX variations

From: Erez Zadok
Date: Mon Nov 30 2009 - 23:51:08 EST


In message <1256152779-10054-41-git-send-email-vaurora@xxxxxxxxxx>, Valerie Aurora writes:
> Implement truncate(), ftruncate(), and open(O_TRUNC) for union mounts.
>
> This moves the union_copyup() in do_filp_open() down below may_open()
> - this way you don't copy up a file you don't even have permission to
> open.
>
> may_open() now takes a nameidata * because it may have to do a
> union_copyup() internally if O_TRUNC is specified. It's a trivial
> change, all callers were just doing "may_open(&nd.path, ...)" anyway.
> It kinda sucks, but may_open() auto-magically doing a truncate also
> sucks (may open? may truncate, too!).

Hmmm, perhaps may_open needs to be renamed then? (may_rename_and_truncate?)

> XXX - Only copy up the bytes that won't be truncated.
> XXX - Re-organize code. may_open() especially blah.
> XXX - truncate() implemented as in-kernel file open and ftruncate()
> XXX - Split up into smaller pieces
[...]

Erez.
--
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/