ovh / svfs

The Swift Virtual File System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVFS upload object wrong dir

supnobita opened this issue · comments

Context

  • svfs version : 0.9.0
  • storage provider : swift
  • product : Ubuntu 14.04

Steps to reproduce this issue :

  1. I try to implement rename empty dir in SVFS. In directory.go, function Rename:
if oldDir, ok := oldNode.(*Directory); ok{
    if ok, _ := oldDir.isEmpty(); ok{
        if _,err := d.Mkdir2(req.NewName); err == nil {
            fmt.Println("Rename - creat new dir ok "+req.NewName)
                return d.removeDirectory(oldDir,oldDir.name)
        }
    }
}

with Mkdir2 is clone of Mkdir (without fuserequest struct)
2. When I use Proftpd (ftp server) to upload dir from client to SVFS, (in detail when proftpd mkdir (ex: mkdir Abc), it will create temp dir, then rename temp dir to Abc, then proftpd upload file to Abc) -> But All object that must be in Abc dir (after upload complete), these stay in temp dir
SVFS upload file before I remove temp dir ?
3.

Results you expected :

File in Abc dir will be in Abc dir on SVFS

Results you observed :

Debug log :

Additional information :

Could you give me some ideal, instruction to fix this bug. I must to implement Rename empty dir :(

Thanks so mush

I have solve it for a long time, but forgot to say thank with you.
if err := d.removeDirectory(oldDir,oldDir.name); err == nil{
oldDir = newNode
}
I forgot give oldDir node = new address