mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "Richard B. Johnson" <linux-os@analogic.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to replace an executing file on an embedded system?
Date: Wed, 1 Jun 2005 16:42:03 -0700	[thread overview]
Message-ID: <20050601164203.2729520b@dxpl.pdx.osdl.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0506011828300.5925@chaos.analogic.com>

On Wed, 1 Jun 2005 18:31:07 -0400 (EDT)
"Richard B. Johnson" <linux-os@analogic.com> wrote:

> 
> The newer linux kernels have this problem:
> 
> Suppose I do this:
> 
> cp /sbin/init foo	# Make a copy of 'init'
> mv foo /sbin/init	# Rename it back (emulate install)
> chmod +x /sbin/init	# Make sure we can boot.
> 
> When I try to umount() the file-system, it now fails with
> EBUSY (16).
> 
> I have tried fsync(), sync(), fsync() on /sbin, etc. I can't
> get rid of the busy inodes.
> 
> This reared its ugly head with field software upgrades. We
> used to be able to upload new software for every executable
> on an embedded system using the network or a serial link.
> 
> This would replace every file. We would then kill all the
> tasks except 'init', unmount the file-system and then reboot.
> The upgrade was finished. Every lived happily ever after.
> But, with newer kernels, we can't.
> 
> What am I missing?  How am I supposed to replace files that
> are being executed? Do I have to `mv` them to /tmp and
> delete them on the next boot? (not easy, we don't have
> a shell, I would have to write code to search /tmp). Also
> 'init' isn't SYS-V 'init'. It's just the startup program
> for a system that keeps growing so I need to be able to
> upgrade it.

The image of the file being executed has to exist because
the text portion could be needed at any time for a page in.

You can move it in the same filesystem (since the open file handle 
stays the same), or even delete it (since it doesn't disappear till
last reference goes away). but you can't unmount the file system because
the inode is still busy.



  parent reply	other threads:[~2005-06-01 23:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-01 22:31 Richard B. Johnson
2005-06-01 23:37 ` Bernd Eckenfels
2005-06-02  0:05   ` Al Viro
2005-06-01 23:42 ` Stephen Hemminger [this message]
2005-06-02  0:11 ` Miquel van Smoorenburg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050601164203.2729520b@dxpl.pdx.osdl.net \
    --to=shemminger@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®