linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jordi Pujol <jordipujolp@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: overlayfs patches for ovl_copy_up & ovl_rename
Date: Wed, 18 May 2011 09:44:34 +0200	[thread overview]
Message-ID: <201105180944.35027.jordipujolp@gmail.com> (raw)
In-Reply-To: <87vcx9cib2.fsf@tucsk.pomaz.szeredi.hu>

A Dimarts 17 Maig 2011 20:07:13, vàreu escriure:
> Jordi, what about the original bug you reported:
> >>>- a few days ago we talked about an error when repetitive sed
> >>>instructions were executed, also it happens in other processes, like
> >>>mantaining list of installed files for actual packages,
> >>>that is solved in ovl_rename issuing a dget for the old-dentry and
> >>>parent dentries. (This code is inspired on rename.c from unionfs)
> 
> Is this still happening?  Does the debug patch make any difference?

my patch adds some dget/dput operations that minimize the problem, it occurs 
less times, but it happens.
I suppose that those extra operations add an execution delay before processing 
the main routine;
a deduction is that locking dentries is required to synchronize a rename to 
not be executed until another rename operation has finished.

As an example of code that looks like that of unionfs, (this is not tested) 

struct ovl_entry {
	struct dentry *__upperdentry;
	struct dentry *lowerdentry;
+	struct mutex d_mutex;
	union {
		struct {
			u64 version;
			bool opaque;
		};
		struct rcu_head rcu;
	};
};

static struct ovl_entry *ovl_alloc_entry(void)
{
	struct ovl_entry *oe;

	oe = kzalloc(sizeof(struct ovl_entry), GFP_KERNEL);
	mutex_init(&oe->d_mutex);

	return oe;
}

void ovl_lock_dentry(struct dentry *dentry)
{
	struct ovl_entry *oe = dentry->d_fsdata;

	mutex_lock(&oe->d_mutex);
}

void ovl_unlock_dentry(struct dentry *dentry)
{
	struct ovl_entry *oe = dentry->d_fsdata;

	mutex_unlock(&oe->d_mutex);
}

static int ovl_rename(struct inode *olddir, struct dentry *old,
			struct inode *newdir, struct dentry *new)
{
	int err;
...........
+	ovl_lock_dentry(old);

	err = ovl_copy_up(old);
...........
+	ovl_unlock_dentry(old);
	return err;
}

consider this idea,

Thanks,

Jordi Pujol

Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-05-18  7:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 14:59 overlayfs patches for ovl_copy_up & ovl_rename Jordi Pujol
2011-05-05  9:06 ` Miklos Szeredi
2011-05-09  6:38   ` Jordi Pujol
2011-05-10 16:20     ` Miklos Szeredi
2011-05-17  8:43       ` Miklos Szeredi
2011-05-17 17:18         ` Jordi Pujol
2011-05-17 18:07           ` Miklos Szeredi
2011-05-18  7:44             ` Jordi Pujol [this message]
2011-05-18  8:42               ` Miklos Szeredi
2011-05-19  7:47                 ` Jordi Pujol
2011-05-19  8:49                   ` Miklos Szeredi
2011-05-19  9:24                     ` Jordi Pujol
2011-05-19  9:52                       ` Miklos Szeredi
2011-05-19 13:34                         ` Jordi Pujol
2011-05-21  5:10                       ` Jordi Pujol
2011-05-23  9:21                         ` Miklos Szeredi
2011-05-24 15:53                           ` Jordi Pujol
2011-05-27 15:03                           ` Jordi Pujol
2011-05-31  9:01                             ` Miklos Szeredi
2011-05-19  8:52                   ` Jordi Pujol

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=201105180944.35027.jordipujolp@gmail.com \
    --to=jordipujolp@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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;
as well as URLs for NNTP newsgroup(s).