Re: [patch 1/1] PM: Adds remount fs ro at suspend

From: Christoph Hellwig
Date: Mon Feb 05 2007 - 11:56:57 EST


On Sat, Feb 03, 2007 at 03:34:57PM -1000, akuster wrote:
> >Can you please explain why this can't be done in userspace?
>
> I am sure it can. The idea came from customer inputs, speed is my
> guess. echo mem > /sys/../state seems a whole lot simpler and cleaner
> than having userspace figure out what it mounted and then doing echo mem.

I don't think we really want people to use the kernel interface directly.
Currently the distros seem to use the s2ram and s2disk helpers IIRC.

In any case there should be a userland abstraction doing all helper work
and finally calling into the kernel.

It would be nice if the embedded folk could work together with the desktop
people on the userland bits for power managment.

> In fact
> >all existing suspend solutions seem to be doing fine doing things like
> >this in userspace.
>
> I guess I missed that boat. If you don't mind, could you point at one
> solution.

> >NACK. emergency_remount is exactly what it sais and should never ever
> >be used for a system that you want to keep on using later on.
>
> The code "emergency_remount" is almost identical to what we have been
> using. I wanted to reuse existing code rather than dup it.

The problem with emergency_remount is that it calls do_remount_sb with
the force argument, which then calls into mark_files_ro. This isn't
very useful because it doesn't actually stop existing writers and seems
to have a racy f_mode access. Then again it doesn't really help either
that we want to get rid of file_list_lock the sb->s_files :)

If you really want to stop all current writes you need to call freeze_bdev,
and I'd rather expose that through a separate user interface instead of
hooking it into the suspend process at the kernel side. For XFS you
could use the private ioctls already today, but I'd prefer a more general
solution.

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