Patchwork [BUG:1397] protocol/client: fix ESTALE in statfs on root inode

login
register
Submitter Amar Tumballi
Date 2010-08-19 10:03:07
Message ID <20100819100307.GA11542@gluster.com>
Download mbox | patch
Permalink /patch/4204/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Amar Tumballi - 2010-08-19 10:03:07
Signed-off-by: Amar Tumballi <amar@gluster.com>
---
 xlators/protocol/client/src/client3_1-fops.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

Patch

diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index cddfbcf..75034dd 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -3705,15 +3705,20 @@  client3_1_statfs (call_frame_t *frame, xlator_t *this,
 
         args = data;
 
-        if (args->loc->inode) {
-                ret = inode_ctx_get2 (args->loc->inode, this,
-                                      &req.ino, &req.gen);
-                if (args->loc->inode->ino && ret < 0) {
-                        gf_log (this->name, GF_LOG_TRACE,
-                                "STATFS %"PRId64" (%s): "
-                                "failed to get remote inode number",
-                                args->loc->inode->ino, args->loc->path);
-                        goto unwind;
+        if (args->loc && args->loc->inode) {
+                if (args->loc->inode->ino == 1) {
+                        req.ino = 1;
+                        req.gen = 0;
+                } else {
+                        ret = inode_ctx_get2 (args->loc->inode, this,
+                                              &req.ino, &req.gen);
+                        if (args->loc->inode->ino && ret < 0) {
+                                gf_log (this->name, GF_LOG_TRACE,
+                                        "STATFS %"PRId64" (%s): "
+                                        "failed to get remote inode number",
+                                        args->loc->inode->ino, args->loc->path);
+                                goto unwind;
+                        }
                 }
         }
         req.path = (char *)args->loc->path;