[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200810262101.08822.rjw@sisk.pl>
Date: Sun, 26 Oct 2008 21:01:08 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Nigel Cunningham <ncunningham@...a.org.au>,
Miklos Szeredi <miklos@...redi.hu>
Cc: linux-pm@...ts.linux-foundation.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [linux-pm] Freezer: Don't count threads waiting for frozen filesystems.
On Saturday, 25 of October 2008, Nigel Cunningham wrote:
> Hi.
Hi Nigel,
> While working on freezing fuse filesystems, I found that if a filesystem
> is frozen when we try to freeze processes, freezing can fail because
> threads are waiting in vfs_check_frozen for the filesystem to be thawed.
> We should thus not count such threads.
>
> The check will be safe if a filesystem is thawed while we're freezing
> processes because filesystem thaws are only invoked from userspace. Any
> waiting processes will be woken and frozen prior to us completing the
> freezing of userspace (the caller invoking the filesystem thaw will be
> freezing) or - in the worst case - together with kernel threads.
While your description above seems completely correct to me and I have no
objections to the patch, I'd prefer it if someone having more experience with
the VFS looked at it. Miklos, can you have a look, please?
Thanks,
Rafael
> Signed-off-by: Nigel Cunningham <nigel@...onice.net>
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index a6a625b..c9b055d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -8,6 +8,7 @@
>
> #include <linux/limits.h>
> #include <linux/ioctl.h>
> +#include <linux/freezer.h>
>
> /*
> * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
> @@ -1187,8 +1190,11 @@ enum {
> SB_FREEZE_TRANS = 2,
> };
>
> -#define vfs_check_frozen(sb, level) \
> - wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
> +#define vfs_check_frozen(sb, level) do { \
> + freezer_do_not_count(); \
> + wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))); \
> + freezer_count(); \
> +} while (0)
>
> #define get_fs_excl() atomic_inc(¤t->fs_excl)
> #define put_fs_excl() atomic_dec(¤t->fs_excl)
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists