1

I am on Red hat GNU/linux 2.6.32-431.29.2.el6.x86_64.

Recently - One of my process hung. This process was using few files from a directory - say DIR-1 . While process was in hung state, I moved ( and not copied ) these files to a backup dir - say DIR-BKP and added newer version of the files to DIR-1 directory. Note these newer version of files have exactly same as the ones from DIR-BKP folder.

Since my process is still in hung state during all this, what will happen if I start a new process, which is going to use files from DIR-1 ? Will the new process use files from DIR-BKP or DIR-1 ? Since old process is still using older version of files ( albeit they are moved to DIR-BKP directory ) , not sure if the new process will use newer version of files or will keep using older version.

1

If you copy files to a new location, then no process is going to be aware of that unless you change something to direct it to the new location (e.g. change a command line option or edit a config file somewhere). A process isn't going to automatically follow the files if you move them. So, the new process should attempt to use the files from DIR-1.

A couple of questions though:

  1. Why don't you just kill the hung process before starting a new one (possibly safer)?

  2. Why didn't you just copy the files, rather than move, if the new ones are exactly the same?

  • Why don't you just kill the hung process before starting a new one (possibly safer)? - Actually, I did not notice hung process during deployment, I deployed newer version of files and realized after couple of days that there is hung process. So - ideally - yes, I should have killed the hung process but did not . – user1289117 Dec 8 '17 at 19:25
  • Thanks for valuable input. I was also having same impression but was willing to confirm. There was a doubt in my mind - whether kernel uses file handle from already hung process or look for a new file handle when a new process is started. – user1289117 Dec 8 '17 at 19:29
  • No problem. In general, processes locate files based on their path in the filesystem. If you change the path to a file, then you would usually have to tell that to the process somehow. Unless it has some clever way of searching the filesystem for a particular file (which is rare). – Time4Tea Dec 8 '17 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.