From 8a66041f90db8205db50fd83aed8001175c787ed Mon Sep 17 00:00:00 2001 From: slioch Date: Mon, 2 Mar 2009 22:28:16 -0800 Subject: added fix for nested priority and deletion failure. also priorities should not reside on node.tags, but on parent (node name of multinode)--this is to prevent priorities splitting behaviors between different priorities on multinodes. --- src/common/unionfs.c | 26 +++++++++++++++++++------- templates/priority | 22 +++++++++++----------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 0aaffe0..4cb2ed6 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -1066,8 +1066,10 @@ delete_func(GNode *node, gpointer data) char *command = malloc(MAX_LENGTH_DIR_PATH); struct SrcDst *sd = (struct SrcDst*)data; + //DONT HAVE THE COMMAND BELOW BLOW AWAY WHITEOUT FILES!!!!! static const char format[]="rm -f %s%s{*,.*} >&/dev/null;rmdir %s%s >&/dev/null ; /bin/true"; //need to remove opaque file. - static const char format_force_delete[]="rm -f %s%s{*,.*} >&/dev/null;rm -fr %s%s >&/dev/null ; /bin/true"; //force delete as this is a delete operation with dependency + static const char format_force_delete[]="rm -f %s%s{*,.*} >&/dev/null;rmdir %s%s >&/dev/null ; /bin/true"; //force delete as this is a delete operation with dependency + static const char delete_format[]="rm %s%s../.wh.%s >&/dev/null"; char *path = ((struct VyattaNode*)(node->data))->_data._path; @@ -1078,13 +1080,23 @@ delete_func(GNode *node, gpointer data) //WILL ONLY REMOVE DIRS WITHOUT CHILD DIRS--just what we want.. - sprintf(command,format,sd->_src,path,sd->_src,path); - if (g_debug) { - printf("%s\n",command); - fflush(NULL); + //NEED TO PREVENT THE COMMAND BELOW FROM DELETING WHITEOUT FILES.... + + if (IS_NOOP(((struct VyattaNode*)(node->data))->_data._operation)) { + return FALSE; //see if we can skip this node here } - if (sd->_test_mode == FALSE) { - system(command); + + + //DOESN'T QUITE FIX THE PROBLEM, THE PARENT IS CALLED (AND PROBABLY SHOULDN'T BE) + if (!IS_DELETE(((struct VyattaNode*)(node->data))->_data._operation)) { + sprintf(command,format,sd->_src,path,sd->_src,path); + if (g_debug) { + printf("%s\n",command); + fflush(NULL); + } + if (sd->_test_mode == FALSE) { + system(command); + } } //if this is a deletion operation, need to remove diff --git a/templates/priority b/templates/priority index fe4babd..8b8118a 100644 --- a/templates/priority +++ b/templates/priority @@ -4,21 +4,21 @@ 301 protocols/ospfv3 302 protocols/rip 303 protocols/ripng -310 interfaces/bridge/node.tag -320 interfaces/ethernet/node.tag -320 interfaces/loopback/node.tag -330 interfaces/adsl/node.tag -340 interfaces/serial/node.tag -350 interfaces/wirelessmodem/node.tag -380 interfaces/tunnel/node.tag -380 interfaces/openvpn/node.tag -390 interfaces/bonding/node.tag +310 interfaces/bridge +320 interfaces/ethernet +320 interfaces/loopback +330 interfaces/adsl +340 interfaces/serial +350 interfaces/wirelessmodem +380 interfaces/tunnel +380 interfaces/openvpn +390 interfaces/bonding 400 system 450 protocols/static 470 policy -500 protocols/bgp/node.tag +500 protocols/bgp 510 protocols/bgp/node.tag/parameters -520 protocols/bgp/node.tag/neighbor/node.tag +520 protocols/bgp/node.tag/neighbor 530 protocols/bgp/node.tag/ipv6 530 protocols/bgp/node.tag/network 530 protocols/bgp/node.tag/redistribute -- cgit v1.2.3