summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-09-21 05:19:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-22 06:12:55 -0700
commit1fc259cb73cb199052519f548dfbb1b83829b28f (patch)
tree2fa2d3f894f31e009b1a85870ba3a52a12e71da2 /xlators/storage/posix/src
parent578e42399fa86f15dffffd5d35f96f3a248d651d (diff)
storage/posix: Update nr_files after system call succeeds.
In posix_open(), posix_create(), and posix_close(), update stats->nr_files only after the FOP has succeeded. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 248 (Updating stats in posix is incorrect) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=248
Diffstat (limited to 'xlators/storage/posix/src')
-rw-r--r--xlators/storage/posix/src/posix.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index ef68aa72e3f..4f095d17bc9 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1815,12 +1815,6 @@ posix_open (call_frame_t *frame, xlator_t *this,
fd_ctx_set (fd, this, (uint64_t)(long)pfd);
- LOCK (&priv->lock);
- {
- priv->stats.nr_files++;
- }
- UNLOCK (&priv->lock);
-
#ifndef HAVE_SET_FSID
if (flags & O_CREAT) {
op_ret = chown (real_path, frame->root->uid, gid);
@@ -1863,6 +1857,12 @@ posix_open (call_frame_t *frame, xlator_t *this,
}
}
+ LOCK (&priv->lock);
+ {
+ priv->stats.nr_files++;
+ }
+ UNLOCK (&priv->lock);
+
op_ret = 0;
out:
@@ -2246,12 +2246,6 @@ posix_release (xlator_t *this,
priv = this->private;
- LOCK (&priv->lock);
- {
- priv->stats.nr_files--;
- }
- UNLOCK (&priv->lock);
-
ret = fd_ctx_get (fd, this, &tmp_pfd);
if (ret < 0) {
op_errno = -ret;
@@ -2280,6 +2274,12 @@ posix_release (xlator_t *this,
goto out;
}
+ LOCK (&priv->lock);
+ {
+ priv->stats.nr_files--;
+ }
+ UNLOCK (&priv->lock);
+
op_ret = 0;
out: