From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Siddhartha Jain" Subject: Replicating directories - Intercepting write/modify system calls Date: Thu, 12 Feb 2004 18:09:13 +0530 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from mymail.netmagicians.com ([202.87.39.126]:22922 "HELO mymail.netmagicians.com") by vger.kernel.org with SMTP id S266381AbUBLMoW (ORCPT ); Thu, 12 Feb 2004 07:44:22 -0500 To: List-Id: linux-fsdevel.vger.kernel.org Hello, I need a module/tool to replicate directories locally or across a network. Locally, the master and the mirror directories may not belong to the same FS. My immiediate need is to replicate a NFS-mounted directory to another local/NFS directory. So here is what I figured: 1. A config file contains the master and mirror paths 2. Expand the vnode structure to include two things: a bit-flag to indicate that the vnode has a replica and a pointer to the replica vnode. 3. When an open() is called, a. check if the read/modify option is set in the open() (I am not interested in replicating access-time at the moment). b. If yes, check the path of the file against the known masters in the config. c. If it matches, copy the file to a destination specified by the mirror's path. d. Set the flag in the master vnode for replica and place a pointer to the replica vnode in the master's structure. e. After this replicate all write() calls for the master vnode to the replica vnode. f. close() the replica vnode when the master is close()-ed. Being a sysadmin and not really a C/Kernel programmer, I do not know how much is this feasible and practical. Given that it is ok, how do I avoid the copy at open() and do only incremental changes everytime a file is closed and re-opened. Regards, Siddhartha