Bug 764165 (GLUSTER-2433) - Creating/Deleting sparse files messes with available space
Summary: Creating/Deleting sparse files messes with available space
Keywords:
Status: CLOSED WORKSFORME
Alias: GLUSTER-2433
Product: GlusterFS
Classification: Community
Component: replicate
Version: 3.1.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Pranith Kumar K
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-15 23:30 UTC by Joe Julian
Modified: 2015-12-01 16:45 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: ---
Mount Type: fuse
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Joe Julian 2011-02-15 23:30:12 UTC
When creating and deleting a sparse file, the available space is not allocated and released consistently.

1. Create a replicated volume (gluster volume create test1 replica 2 server1:/var/spool/gluster/disk1 server2:/var/spool/gluster/disk1)
2. mount the replicated volume (mount -t glusterfs server1:test1 /mnt/test1)
2. df # note the available space (in my test it is 2498816)
3. dd if=/dev/zero of=/mnt/test1/testfile1 bs=1 count=1 seek=1M # create a sparse file 
4. df # the available space has decreased by 1M (2498688)
5. rm /mnt/test1/testfile1
6. df # the available space has not increased (2498688)

This behavior is not reproducible in 3.0.7.

Comment 1 Pranith Kumar K 2011-02-18 02:54:56 UTC
(In reply to comment #0)
> When creating and deleting a sparse file, the available space is not allocated
> and released consistently.
> 
> 1. Create a replicated volume (gluster volume create test1 replica 2
> server1:/var/spool/gluster/disk1 server2:/var/spool/gluster/disk1)
> 2. mount the replicated volume (mount -t glusterfs server1:test1 /mnt/test1)
> 2. df # note the available space (in my test it is 2498816)
> 3. dd if=/dev/zero of=/mnt/test1/testfile1 bs=1 count=1 seek=1M # create a
> sparse file 
> 4. df # the available space has decreased by 1M (2498688)
> 5. rm /mnt/test1/testfile1
> 6. df # the available space has not increased (2498688)
> 
> This behavior is not reproducible in 3.0.7.

This is working fine for me with the *master* branch.
pranith @ /mnt/client
11:18:17 :) $ df /mnt/client
Filesystem           1K-blocks      Used Available Use% Mounted on
pranith-laptop:/vol   96178944   5011456  86281856   6% /mnt/client

pranith @ /mnt/client
11:18:28 :) $ sudo dd if=/dev/zero of=testfile1 bs=1 count=1 seek=1M
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.00327276 s, 0.3 kB/s

pranith @ /mnt/client
11:18:51 :) $ df /mnt/client
Filesystem           1K-blocks      Used Available Use% Mounted on
pranith-laptop:/vol   96178944   5011456  86281856   6% /mnt/client

pranith @ /mnt/client
11:18:53 :) $ df /mnt/client
Filesystem           1K-blocks      Used Available Use% Mounted on
pranith-laptop:/vol   96178944   5011456  86281728   6% /mnt/client

pranith @ /mnt/client
11:20:43 :) $ sudo rm -f testfile1 

pranith @ /mnt/client
11:20:50 :) $ df /mnt/client
Filesystem           1K-blocks      Used Available Use% Mounted on
pranith-laptop:/vol   96178944   5011456  86281856   6% /mnt/client

pranith @ /mnt/client
11:21:33 :) $ sudo gluster volume info

Volume Name: vol
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: pranith-laptop:/tmp/1
Brick2: pranith-laptop:/tmp/2

Comment 2 Pranith Kumar K 2011-02-21 08:07:50 UTC
hi,
   It is working as expected for me. Please re-open the bug if it is observed again. It is better to use "df -B 1 <mount-path>" instead of just df to avoid rounding to nearest block size.

Pranith.


Note You need to log in before you can comment on or make changes to this bug.