All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uli Martens <um@scientific.de>
To: Christoph Rohland <cr@sap.com>, lkml <linux-kernel@vger.kernel.org>
Subject: [patch] tmpfs: incr. link-count on directory rename
Date: 14 Feb 2002 02:07:18 +0100	[thread overview]
Message-ID: <1013648840.2317.5.camel@isax> (raw)

Hi Christoph, hi all! 

When I move a directory into another on a tmpfs filesystem, the
link-count of the new parent directory isn't getting incremented. 
(which leads to find getting hickup, which eg. lets dpkg produce a
"bzip2" binary package without binaries, generally not a nice thing) 

test: 

isax@home:/tmp/test$ mkdir t1 
isax@home:/tmp/test$ mkdir t2 
isax@home:/tmp/test$ mv t2 t1 
isax@home:/tmp/test$ ls -lRa 
.: 
total 0 
drwxr-xr-x    5 isax     isax            0 Feb 13 23:05 . 
drwxrwxrwt   13 root     root            0 Feb 13 23:04 .. 
drwxr-xr-x    2 isax     isax            0 Feb 13 23:05 t1 

./t1: 
total 0 
drwxr-xr-x    2 isax     isax            0 Feb 13 23:05 . 
drwxr-xr-x    5 isax     isax            0 Feb 13 23:05 .. 
drwxr-xr-x    2 isax     isax            0 Feb 13 23:05 t2 

./t1/t2: 
total 0 
drwxr-xr-x    2 isax     isax            0 Feb 13 23:05 . 
drwxr-xr-x    2 isax     isax            0 Feb 13 23:05 .. 

the link count of "t1", "t1/." and "t1/t2/.." should be "3", not "2". 
The following patch seems to work fine for me and is tested on my
machine running debian's 2.4.17-1 and user-mode-linux 2.5.1-1. 
This is my first patch to the kernel, so I suppose there is a really
huge mistake in my patch I don't see now... 
 
--- linux/mm/shmem.orig Wed Feb 13 00:56:14 2002
+++ linux/mm/shmem.c    Wed Feb 13 18:09:04 2002
@@ -1085,6 +1085,9 @@
 {
        int error = -ENOTEMPTY;
 
+       if (S_ISDIR(old_dentry->d_inode->i_mode)) {
+               new_dir->i_nlink++;
+       }
        if (shmem_empty(new_dentry)) {
                struct inode *inode = new_dentry->d_inode;
                if (inode) {

-- 
uli martens


             reply	other threads:[~2002-02-14  1:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-14  1:07 Uli Martens [this message]
2002-02-14  6:19 ` [patch] tmpfs: incr. link-count on directory rename Jan Harkes
2002-02-14  9:34   ` Uli Martens
2002-02-19 16:39     ` Christoph Rohland

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=1013648840.2317.5.camel@isax \
    --to=um@scientific.de \
    --cc=cr@sap.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.